communishift: wip cleanup and notifcation tasks

Signed-off-by: David Kirwan <davidkirwanirl@gmail.com>
This commit is contained in:
David Kirwan 2024-10-24 08:12:24 +01:00
parent b6e51f8c7b
commit 8a30fc6118
No known key found for this signature in database
GPG key ID: A5893AB6474AC37D
6 changed files with 63 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -1,2 +0,0 @@
---
- include_tasks: deploy-communishift-authorization-operator.yml

View file

@ -0,0 +1,4 @@
---
- include_tasks: send-tenant-deletion-notifications.yml
- include_tasks: start-tenant-project-cleanup.yml

View file

@ -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 <dkirwan+communishift_notification_test_1@redhat.com>
- David K <dkirwan+communishift_notification_test_2@redhat.com>
cc: David Kirwan <dkirwan@redhat.com>
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

View file

@ -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