diff --git a/playbooks/manual/communishift.yml b/playbooks/manual/communishift.yml index 83e61bd4d7..aa07922ac3 100644 --- a/playbooks/manual/communishift.yml +++ b/playbooks/manual/communishift.yml @@ -19,7 +19,7 @@ - name: Communishift Role include_role: name: communishift - tasks_from: administration-tasks + tasks_from: deploy-communishift-authorization-operator apply: tags: - deploy-operators diff --git a/playbooks/manual/communishift_cleanup.yml b/playbooks/manual/communishift_cleanup.yml new file mode 100644 index 0000000000..b2c84d6f48 --- /dev/null +++ b/playbooks/manual/communishift_cleanup.yml @@ -0,0 +1,28 @@ +--- +- hosts: localhost + user: root + gather_facts: false + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - "/srv/private/ansible/vars.yml" + - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml + + tasks: + - name: Configure the communishift virtualenv + ansible.builtin.pip: + name: "{{ communishift_package }}" + with_items: "{{ communishift_package_list }}" + loop_control: + loop_var: communishift_package + + - name: Communishift Cluster Cleanup Tasks + with_items: "{{ communishift_projects }}" + include_role: + name: communishift + tasks_from: cleanup-administration-tasks + loop: "{{ lookup('dict', communishift_projects) }}" + vars: + communishift_package_list: + - kubernetes + - boto3 diff --git a/roles/communishift/tasks/administration-tasks.yml b/roles/communishift/tasks/administration-tasks.yml deleted file mode 100644 index 6a2f48c346..0000000000 --- a/roles/communishift/tasks/administration-tasks.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include_tasks: deploy-communishift-authorization-operator.yml diff --git a/roles/communishift/tasks/cleanup-administration-tasks.yml b/roles/communishift/tasks/cleanup-administration-tasks.yml new file mode 100644 index 0000000000..9941a28649 --- /dev/null +++ b/roles/communishift/tasks/cleanup-administration-tasks.yml @@ -0,0 +1,4 @@ +--- +- include_tasks: send-tenant-deletion-notifications.yml +- include_tasks: start-tenant-project-cleanup.yml + diff --git a/roles/communishift/tasks/send-tenant-deletion-notifications.yml b/roles/communishift/tasks/send-tenant-deletion-notifications.yml new file mode 100644 index 0000000000..7670c54654 --- /dev/null +++ b/roles/communishift/tasks/send-tenant-deletion-notifications.yml @@ -0,0 +1,21 @@ +--- +- name: Send Communishift Project Cleanup notifications emails to tenants + community.general.mail: + host: localhost + port: 25 + subject: "Fedora Communishift Notification: {{ item.value.name }}" + body: "This is a reminder that the Communishift project {{ item.value.name }} will be deleted during the Fedora post release process. Please ensure you have a backup of any important configuration or data from your project." + from: admin@fedoraproject.org + to: + - D Kirwan + - David K + cc: David Kirwan + headers: + - Reply-To=admin@fedoraproject.org + charset: us-ascii + delegate_to: localhost + when: {{ not item.value.do_not_delete | bool }} + tags: + - communishift_send_notifications + - never # Only send notifications when the tag communishift_send_notifications is passed + diff --git a/roles/communishift/tasks/start-tenant-project-cleanup.yml b/roles/communishift/tasks/start-tenant-project-cleanup.yml new file mode 100644 index 0000000000..a017c55bc2 --- /dev/null +++ b/roles/communishift/tasks/start-tenant-project-cleanup.yml @@ -0,0 +1,9 @@ +--- +- name: "Offboard the Communishift tenant project: {{ item.value.name }}" + debug: + msg: "delete task for project: {{ item.value.name }}" + when: {{ not item.value.do_not_delete | bool }} + tags: + - communishift_cluster_cleanup + - never # Only run this task when the communishift_cluster_cleanup tag is called +