1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Skip some service tests for systemd.

This commit is contained in:
Matt Clay 2016-05-31 13:43:06 -07:00
parent c52cea8db3
commit e45b3b89a2
4 changed files with 19 additions and 0 deletions

View file

@ -38,39 +38,47 @@
- name: find the service with a pattern
service: name=ansible_test pattern="ansible_test_ser*" state=started
register: start2_result
when: service_type != "systemd"
- name: assert that the service was started via the pattern
assert:
that:
- "start2_result.name == 'ansible_test'"
- "start2_result.state == 'started'"
when: service_type != "systemd"
- name: restart the ansible test service
service: name=ansible_test state=restarted
register: restart_result
when: service_type != "systemd"
- name: assert that the service was restarted
assert:
that:
- "restart_result.state == 'started'"
when: service_type != "systemd"
- name: restart the ansible test service with a sleep
service: name=ansible_test state=restarted sleep=2
register: restart_sleep_result
when: service_type != "systemd"
- name: assert that the service was restarted with a sleep
assert:
that:
- "restart_sleep_result.state == 'started'"
when: service_type != "systemd"
- name: reload the ansible test service
service: name=ansible_test state=reloaded
register: reload_result
when: service_type != "systemd"
- name: assert that the service was reloaded
assert:
that:
- "reload_result.state == 'started'"
when: service_type != "systemd"
- name: stop the ansible test service
service: name=ansible_test state=stopped
@ -84,11 +92,13 @@
- name: disable the ansible test service
service: name=ansible_test enabled=no
register: disable_result
when: service_type != "systemd"
- name: assert that the service was disabled
assert:
that:
- "disable_result.enabled == false"
when: service_type != "systemd"
- name: try to enable a broken service
service: name=ansible_broken_test enabled=yes

View file

@ -1,3 +1,6 @@
- name: set service_type fact
set_fact: service_type=systemd
- name: install the systemd unit file
copy: src=ansible.systemd dest=/etc/systemd/system/ansible_test.service
register: install_systemd_result

View file

@ -1,3 +1,6 @@
- name: set service_type fact
set_fact: service_type=sysv
- name: install the sysV init file
copy: src=ansible.sysv dest=/etc/init.d/ansible_test mode=0755
register: install_sysv_result

View file

@ -1,3 +1,6 @@
- name: set service_type fact
set_fact: service_type=upstart
- name: install the upstart init file
copy: src=ansible.upstart dest=/etc/init/ansible_test.conf mode=0644
register: install_upstart_result