-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuke_it.yml
57 lines (49 loc) · 1.54 KB
/
nuke_it.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
# Playbook to destroy Pulp software repository on target host/group.
#
# Use Podman to destroy and cleanup the "Pulp in One Container" container image
#
# Dependencies:
# collections:
# - container.podman
#
- name: Nuke the Pulp in One Container container
hosts: pulp
remote_user: "{{ pulp_system_user | default('pulp') }}"
vars:
# Name of container to destroy
pulp_container_name: pulp
tasks:
- name: Tell Podman to ask Pulp to stop
containers.podman.podman_container:
name: pulp
state: stopped
- name: Ensure the Pulp service is stopped and disabled
ansible.builtin.systemd:
name: "container-{{ pulp_container_name }}.service"
state: stopped
enabled: false
scope: user
- name: Remove the systemd unit file of the Pulp container
ansible.builtin.file:
path: "{{ ansible_facts.user_dir }}/.config/systemd/user/container-{{ pulp_container_name }}.service"
state: absent
notify:
- Perform systemd daemon-reload
- name: Remove pulp_glue python dependency of pulp.squeezer collection
ansible.builtin.pip:
name: pulp-glue
state: absent
handlers:
- name: Perform systemd daemon-reload
ansible.builtin.systemd:
daemon_reload: true
scope: user
- name: Remove leftover data files
hosts: pulp
become: true
tasks:
- name: Wipe directories that preserve Pulp state
ansible.builtin.file:
path: "/home/{{ pulp_system_user | default('pulp') }}/pulp"
state: absent