PageRenderTime 16ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/test/integration/roles/test_service/tasks/main.yml

https://github.com/ajanthanm/ansible
YAML | 108 lines | 87 code | 21 blank | 0 comment | 0 complexity | 112528dd061dc7bf0d93368e49858411 MD5 | raw file
  1- name: install the test daemon script
  2  copy: src=ansible_test_service dest=/usr/sbin/ansible_test_service mode=755
  3  register: install_result
  4
  5- name: assert that the daemon script was installed
  6  assert:
  7    that:
  8    - "install_result.dest == '/usr/sbin/ansible_test_service'"
  9    - "install_result.md5sum == '9ad49eaf390b30b1206b793ec71200ed'"
 10    - "install_result.state == 'file'"
 11    - "install_result.mode == '0755'"
 12
 13- include: 'sysv_setup.yml'
 14  when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux']
 15- include: 'systemd_setup.yml'
 16  when: ansible_distribution == 'Fedora'
 17- include: 'upstart_setup.yml'
 18  when: ansible_distribution == 'Ubuntu'
 19
 20- name: enable the ansible test service
 21  service: name=ansible_test enabled=yes
 22  register: enable_result
 23
 24- name: assert that the service was enabled
 25  assert:
 26    that:
 27    - "enable_result.enabled == true"
 28
 29- name: start the ansible test service
 30  service: name=ansible_test state=started
 31  register: start_result
 32
 33- name: assert that the service was started
 34  assert:
 35    that:
 36    - "start_result.state == 'started'"
 37
 38- name: find the service with a pattern
 39  service: name=ansible_test pattern="ansible_test_ser*" state=started
 40  register: start2_result
 41
 42- name: assert that the service was started via the pattern
 43  assert:
 44    that:
 45    - "start2_result.name == 'ansible_test'"
 46    - "start2_result.state == 'started'"
 47
 48- name: restart the ansible test service
 49  service: name=ansible_test state=restarted
 50  register: restart_result
 51
 52- name: assert that the service was restarted
 53  assert:
 54    that:
 55    - "restart_result.state == 'started'"
 56
 57- name: restart the ansible test service with a sleep
 58  service: name=ansible_test state=restarted sleep=2
 59  register: restart_sleep_result
 60
 61- name: assert that the service was restarted with a sleep
 62  assert:
 63    that:
 64    - "restart_sleep_result.state == 'started'"
 65
 66- name: reload the ansible test service
 67  service: name=ansible_test state=reloaded
 68  register: reload_result
 69
 70- name: assert that the service was reloaded
 71  assert:
 72    that:
 73    - "reload_result.state == 'started'"
 74
 75- name: stop the ansible test service
 76  service: name=ansible_test state=stopped
 77  register: stop_result
 78
 79- name: assert that the service was stopped
 80  assert:
 81    that:
 82    - "stop_result.state == 'stopped'"
 83
 84- name: disable the ansible test service
 85  service: name=ansible_test enabled=no
 86  register: disable_result
 87
 88- name: assert that the service was disabled
 89  assert:
 90    that:
 91    - "disable_result.enabled == false"
 92
 93- name: remove the test daemon script
 94  file: path=/usr/sbin/ansible_test_service state=absent
 95  register: remove_result
 96
 97- name: assert that the test daemon script was removed
 98  assert:
 99    that:
100    - "remove_result.path == '/usr/sbin/ansible_test_service'"
101    - "remove_result.state == 'absent'"
102
103- include: 'sysv_cleanup.yml'
104  when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux']
105- include: 'systemd_cleanup.yml'
106  when: ansible_distribution == 'Fedora'
107- include: 'upstart_cleanup.yml'
108  when: ansible_distribution == 'Ubuntu'