ansible/test/integration/targets/service/tasks/systemd_setup.yml
Pilou c5f37f6bd6 improve 'service' integration tests (#43655)
* service tests: check that daemon is really running

(spoiler: it isn't)

* service tests: add PIDFile directive in systemd unit

* service tests: check 'changed' too

* service tests: fix indentation & use changed test

* service tests: #16694 has been fixed a long time ago

* service tests: refactor

- always execute cleaning tasks
- move tests tasks in a dedicated file

* service tests: add test for #42786

* service tests: display value of ansible_service_mgr

* service tests: allow to run tests twice in a row

stop & disable ansible test service

* service tests: 'pattern' value must be a substring

'pattern' parameter is poorly named

* service tests: check ansible_test service status

* service tests: test daemon must handle SIGHUP

because 'initctl reload' sends SIGHUP, otherwise test daemon stops when
receiving the signal

* service tests: remove upstart override file too

and check that files were removed using raw module and stat command
2018-08-07 21:48:03 -07:00

17 lines
818 B
YAML

- name: install the systemd unit file
copy: src=ansible.systemd dest=/etc/systemd/system/ansible_test.service
register: install_systemd_result
- name: install a broken systemd unit file
file: src=ansible_test.service path=/etc/systemd/system/ansible_test_broken.service state=link
register: install_broken_systemd_result
- name: assert that the systemd unit file was installed
assert:
that:
- "install_systemd_result.dest == '/etc/systemd/system/ansible_test.service'"
- "install_systemd_result.state == 'file'"
- "install_systemd_result.mode == '0644'"
- "install_systemd_result.checksum == '9e6320795a5c79c01230a6de1c343ea32097af52'"
- "install_broken_systemd_result.dest == '/etc/systemd/system/ansible_test_broken.service'"
- "install_broken_systemd_result.state == 'link'"