forked from pgolm/ansible-role-monit
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvagrant.yml
73 lines (59 loc) · 1.61 KB
/
vagrant.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
- hosts: all
sudo: yes
vars_files:
- vars/test.yml
pre_tasks:
- name: testing - install apache
apt:
pkg: apache2
update_cache: yes
cache_valid_time: 3600
state: installed
roles:
- .
- name: monit - testing reloads on monit_services changes
hosts: all
sudo: yes
tags: monit_tests_reloads
vars_files:
- vars/test.yml
pre_tasks:
- name: testing - set new monit_services
set_fact:
monit_services:
- name: sshd
type: process
target: /var/run/sshd.pid
start: /usr/sbin/service sshd start
stop: /usr/sbin/service sshd stop
- name: testing - get current pid before changes
command: cat /var/run/monit.pid
changed_when: false
register: monit_tests_pid_before
roles:
- .
post_tasks:
- name: testing - get current pid
command: cat /var/run/monit.pid
changed_when: false
register: monit_tests_pid_after
- name: testing - assert that pid didn't change
assert:
that: "monit_tests_pid_after.stdout == monit_tests_pid_before.stdout"
- name: testing - sleep for awhile
pause:
seconds: 25
- name: testing - get monit status output after reload
command: monit status
changed_when: false
register: monit_tests_status_after
- name: testing - assert that status doesn't include any of the removed services
assert:
that:
- "item not in monit_tests_status_after.stdout"
with_items:
- apache
- localhost
- google
- timezone_config