1
0
Fork 0
forked from infra/ansible

communishift: Send email notification when disabling projects

Signed-off-by: David Kirwan <davidkirwanirl@gmail.com>
This commit is contained in:
David Kirwan 2026-05-06 20:11:29 +01:00
commit e6491b5cba
Signed by untrusted user: dkirwan
GPG key ID: A5893AB6474AC37D
3 changed files with 88 additions and 1 deletions

View file

@ -7,6 +7,11 @@
# ansible-playbook .../communishift_disable_project.yml --tags communishift_disable_project \
# -e communishift_disable_shutdown=true
#
# Tenant “disabled” emails (FASJSON BCC, same SMTP path as communishift_send_email_notifications.yml) run after
# shutdown when communishift_disable_shutdown=true, unless skipped (see below). Preview mail targets without SMTP:
# ... -e communishift_disabled_notifications_dry_run=true
# To skip kinit/FASJSON + disabled emails entirely (scale only): -e communishift_disabled_notifications_skip=true
#
# Run with an inventory that merges group_vars/all so communishift_projects is defined.
#
# Run disable tasks only:
@ -34,6 +39,19 @@
- always
tasks:
- name: Communishift Retrieve FASJSON data (for disabled notices)
ansible.builtin.include_role:
name: communishift
tasks_from: cleanup-administration-retrieve-data
apply:
tags:
- communishift_disable_project
when:
- not (communishift_disabled_notifications_skip | default(false) | bool)
- (communishift_disable_shutdown | default(false) | bool) or (communishift_disabled_notifications_dry_run | default(false) | bool)
tags:
- communishift_disable_project
- name: Communishift project shutdown (eligible projects)
ansible.builtin.include_role:
name: communishift
@ -42,3 +60,19 @@
tags:
- communishift_disable_project
loop: "{{ lookup('dict', communishift_projects) }}"
tags:
- communishift_disable_project
- name: Communishift send project disabled notices
ansible.builtin.include_role:
name: communishift
tasks_from: cleanup-administration-send-disabled-notifications
apply:
tags:
- communishift_disable_project
loop: "{{ lookup('dict', communishift_projects) }}"
when:
- not (communishift_disabled_notifications_skip | default(false) | bool)
- (communishift_disable_shutdown | default(false) | bool) or (communishift_disabled_notifications_dry_run | default(false) | bool)
tags:
- communishift_disable_project

View file

@ -1,6 +1,6 @@
---
# Sends Fedora Communishift lifecycle emails to project admins (FASJSON BCC).
# Notifications only — see communishift_disable_project.yml for shutdown-related tasks.
# Notifications only — see communishift_disable_project.yml for shutdown and post-disable tenant emails.
#
# Run notifications only:
# ansible-playbook .../communishift_send_email_notifications.yml --tags communishift_send_notifications

View file

@ -0,0 +1,53 @@
---
# Sent after workloads are scaled down; requires communishift_project_emails (FASJSON) on the host.
- name: Set Communishift disabled-notice context for this project
ansible.builtin.set_fact:
communishift_dn_protected: "{{ item.value.do_not_delete | default(false) | bool }}"
- name: Send Communishift project disabled notices to tenants
community.general.mail:
host: localhost
port: 25
subject: "Fedora Communishift: project {{ item.value.name }} has been disabled"
body: >
Dear Fedora Communishift Project Administrators (BCC'd),
This message confirms that the Communishift project {{ item.value.name }} has been disabled: workloads in
this namespace have been scaled to zero as part of the Fedora Communishift cleanup aligned with the
post-release process.
Persistent data volumes and configuration objects may still exist in the cluster; retrieve anything you still
need according to Openshift documentation. The project may be deleted in a later step of the same process.
If you believe this action was taken in error, open a ticket with the Fedora Infrastructure team:
https://forge.fedoraproject.org/infra/tickets
Please reference the project name and describe the issue.
from: admin@fedoraproject.org
to: "infrastructure@lists.fedoraproject.org"
bcc: "{{ communishift_project_emails[item.value.name]['email_list'] }}"
cc: admin@fedoraproject.org
headers:
- Reply-To=admin@fedoraproject.org
charset: us-ascii
when:
- not communishift_dn_protected
- communishift_disable_shutdown | default(false) | bool
- not communishift_disabled_notifications_dry_run | default(false)
tags:
- communishift_disable_project
- name: Communishift disabled notice (dry-run preview, mail not sent)
ansible.builtin.debug:
msg:
dry_run: true
project: "{{ item.value.name }}"
to: infrastructure@lists.fedoraproject.org
bcc: "{{ communishift_project_emails[item.value.name]['email_list'] }}"
subject: "Fedora Communishift: project {{ item.value.name }} has been disabled"
when:
- not communishift_dn_protected
- communishift_disabled_notifications_dry_run | default(false)
tags:
- communishift_disable_project