mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Failure to enable a service now fails the task
Fixes: 8855
This commit is contained in:
parent
91ca8d42e7
commit
6943ec11a5
7 changed files with 73 additions and 6 deletions
|
@ -0,0 +1,10 @@
|
|||
description "ansible test daemon"
|
||||
|
||||
start on runlevel [345]
|
||||
stop on runlevel [!345]
|
||||
|
||||
expect daemon
|
||||
|
||||
exec ansible_test_service
|
||||
|
||||
manual
|
|
@ -90,6 +90,16 @@
|
|||
that:
|
||||
- "disable_result.enabled == false"
|
||||
|
||||
- name: try to enable a broken service
|
||||
service: name=ansible_test_broken enabled=yes
|
||||
register: broken_enable_result
|
||||
ignore_errors: True
|
||||
|
||||
- name: assert that the broken test failed
|
||||
assert:
|
||||
that:
|
||||
- "broken_enable_result.failed == True"
|
||||
|
||||
- name: remove the test daemon script
|
||||
file: path=/usr/sbin/ansible_test_service state=absent
|
||||
register: remove_result
|
||||
|
|
|
@ -2,11 +2,18 @@
|
|||
file: path=/usr/lib/systemd/system/ansible_test.service state=absent
|
||||
register: remove_systemd_result
|
||||
|
||||
- name: remove the systemd unit file
|
||||
file: path=/usr/lib/systemd/system/ansible_test_broken.service state=absent
|
||||
register: remove_systemd_broken_result
|
||||
|
||||
- debug: var=remove_systemd_broken_result
|
||||
- name: assert that the systemd unit file was removed
|
||||
assert:
|
||||
that:
|
||||
- "remove_systemd_result.path == '/usr/lib/systemd/system/ansible_test.service'"
|
||||
- "remove_systemd_result.state == 'absent'"
|
||||
- "remove_systemd_broken_result.path == '/usr/lib/systemd/system/ansible_test_broken.service'"
|
||||
- "remove_systemd_broken_result.state == 'absent'"
|
||||
|
||||
- name: make sure systemd is reloaded
|
||||
shell: systemctl daemon-reload
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
copy: src=ansible.systemd dest=/usr/lib/systemd/system/ansible_test.service
|
||||
register: install_systemd_result
|
||||
|
||||
- name: install a broken systemd unit file
|
||||
file: src=ansible_test.service path=/usr/lib/systemd/system/ansible_test_broken.service state=link
|
||||
register: install_broken_systemd_result
|
||||
|
||||
- name: assert that the systemd unit file was installed
|
||||
assert:
|
||||
that:
|
||||
|
@ -9,4 +13,6 @@
|
|||
- "install_systemd_result.state == 'file'"
|
||||
- "install_systemd_result.mode == '0644'"
|
||||
- "install_systemd_result.md5sum == 'f634df77d9160ab05bad4ed49d82a0d0'"
|
||||
- "install_broken_systemd_result.dest == '/usr/lib/systemd/system/ansible_test_broken.service'"
|
||||
- "install_broken_systemd_result.state == 'link'"
|
||||
|
||||
|
|
|
@ -2,9 +2,14 @@
|
|||
file: path=/etc/init/ansible_test.conf state=absent
|
||||
register: remove_upstart_result
|
||||
|
||||
- name: remove the upstart init file
|
||||
file: path=/etc/init/ansible_test_broken.conf state=absent
|
||||
register: remove_upstart_broken_result
|
||||
|
||||
- name: assert that the upstart init file was removed
|
||||
assert:
|
||||
that:
|
||||
- "remove_upstart_result.path == '/etc/init/ansible_test.conf'"
|
||||
- "remove_upstart_result.state == 'absent'"
|
||||
|
||||
- "remove_upstart_broken_result.path == '/etc/init/ansible_test_broken.conf'"
|
||||
- "remove_upstart_broken_result.state == 'absent'"
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
copy: src=ansible.upstart dest=/etc/init/ansible_test.conf mode=0644
|
||||
register: install_upstart_result
|
||||
|
||||
- name: install an upstart init file that will fail (manual in .conf)
|
||||
copy: src=ansible-broken.upstart dest=/etc/init/ansible_broken_test.conf mode=0644
|
||||
register: install_upstart_broken_result
|
||||
|
||||
- name: assert that the upstart init file was installed
|
||||
assert:
|
||||
that:
|
||||
|
@ -9,4 +13,7 @@
|
|||
- "install_upstart_result.state == 'file'"
|
||||
- "install_upstart_result.mode == '0644'"
|
||||
- "install_upstart_result.md5sum == 'ab3900ea4de8423add764c12aeb90c01'"
|
||||
|
||||
- "install_upstart_result.dest == '/etc/init/ansible_broken_test.conf'"
|
||||
- "install_upstart_result.state == 'file'"
|
||||
- "install_upstart_result.mode == '0644'"
|
||||
- "install_upstart_result.md5sum == '015e183d10c311276c3e269cbeb309b7'"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue