mirror of https://github.com/ansible/ansible.git
systemd_service: handle failure when mask operation fails (#83079)
* Handle the mask operation failure instead of just marking state changed. Fixes: #81649 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>pull/83083/head
parent
ae2234f185
commit
5dac5d365a
@ -0,0 +1,3 @@
|
||||
---
|
||||
bugfixes:
|
||||
- systemd_service - handle mask operation failure (https://github.com/ansible/ansible/issues/81649).
|
@ -0,0 +1,25 @@
|
||||
- name: Copy service file for mask operation
|
||||
template:
|
||||
src: mask_me.service
|
||||
dest: /etc/systemd/system/mask_me.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
notify: remove unit file
|
||||
|
||||
- name: Reload systemd
|
||||
systemd:
|
||||
daemon_reload: true
|
||||
|
||||
- name: Try to mask already masked service
|
||||
systemd:
|
||||
name: mask_me.service
|
||||
masked: true
|
||||
register: mask_test_1
|
||||
ignore_errors: true
|
||||
|
||||
- name: Test mask service test
|
||||
assert:
|
||||
that:
|
||||
- mask_test_1 is not changed
|
||||
- "'Failed to mask' in mask_test_1.msg"
|
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Mask Me Server
|
||||
Documentation=Mask
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/yes
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
Loading…
Reference in New Issue