Skip to content

Commit f130265

Browse files
committed
Mask tripleo services after removing unit files
There is not a way to mask services which have service files in /etc/systemd/system without first removing the file from there. This is intentional design. Signed-off-by: rabi <[email protected]>
1 parent 35dc39b commit f130265

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

roles/edpm_tripleo_cleanup/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ edpm_service_removal_skip_list:
3737
- tripleo_swift_object_replicator.service
3838
- tripleo_swift_object_server.service
3939
- tripleo_swift_object_updater.service
40+
- tripleo-container-shutdown.service

roles/edpm_tripleo_cleanup/tasks/main.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
name: "{{ item }}"
5050
state: stopped
5151
enabled: false
52-
masked: true
5352
register: result
5453
loop: "{{ tripleo_services }}"
5554
failed_when: false
@@ -74,6 +73,26 @@
7473
loop_var: path
7574
when: edpm_remove_tripleo_unit_files
7675

76+
- name: Mask tripleo services to make them unusable
77+
tags:
78+
- adoption
79+
become: true
80+
ansible.builtin.systemd_service:
81+
name: "{{ item }}"
82+
masked: true
83+
register: result_mask
84+
loop: "{{ tripleo_services }}"
85+
failed_when: false
86+
87+
- name: Check for errors
88+
ansible.builtin.fail:
89+
msg: "Attempt to mask service {{ item.item }} failed with {{ item.msg }}"
90+
loop: "{{ result_mask.results }}"
91+
when: >
92+
('msg' in item) and
93+
(item.msg != '') and
94+
("Could not find the requested service" not in item.msg)
95+
7796
- name: Adopt (stop tracking) certs from tripleo
7897
tags:
7998
- adoption

0 commit comments

Comments
 (0)