mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
61 lines
1.3 KiB
YAML
61 lines
1.3 KiB
YAML
|
- name: reload monit when process is missing
|
||
|
monit:
|
||
|
name: httpd_echo
|
||
|
state: reloaded
|
||
|
register: result
|
||
|
|
||
|
- name: check that state is changed
|
||
|
assert:
|
||
|
that:
|
||
|
- result is success
|
||
|
- result is changed
|
||
|
|
||
|
- name: test process not present
|
||
|
monit:
|
||
|
name: httpd_echo
|
||
|
state: present
|
||
|
timeout: 5
|
||
|
register: result
|
||
|
failed_when: result is not skip and result is success
|
||
|
|
||
|
- name: test monitor missing process
|
||
|
monit:
|
||
|
name: httpd_echo
|
||
|
state: monitored
|
||
|
register: result
|
||
|
failed_when: result is not skip and result is success
|
||
|
|
||
|
- name: start process
|
||
|
shell: "{{ process_run_cmd }}"
|
||
|
|
||
|
- import_tasks: check_state.yml
|
||
|
vars:
|
||
|
reason: verify service running
|
||
|
service_state: "up"
|
||
|
|
||
|
- name: add process config
|
||
|
blockinfile:
|
||
|
path: "{{ monitrc }}"
|
||
|
block: |
|
||
|
check process httpd_echo with matching "httpd_echo"
|
||
|
start program = "{{ process_run_cmd }}"
|
||
|
stop program = "/bin/sh -c 'kill `pgrep -f httpd_echo`'"
|
||
|
if failed host localhost port 8082 then restart
|
||
|
|
||
|
- name: restart monit
|
||
|
service:
|
||
|
name: monit
|
||
|
state: restarted
|
||
|
|
||
|
- name: test process present again
|
||
|
monit:
|
||
|
name: httpd_echo
|
||
|
state: present
|
||
|
register: result
|
||
|
|
||
|
- name: check that state is unchanged
|
||
|
assert:
|
||
|
that:
|
||
|
- result is success
|
||
|
- result is not changed
|