-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify.yml
67 lines (55 loc) · 2.04 KB
/
verify.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
---
- name: Verify
hosts: all
become: True
gather_facts: False
tasks:
- name: Gather package facts
package_facts:
manager: auto
- name: Gather service facts
service_facts:
- name: Ensure ntpd is unarmed
fail:
msg: Service 'ntpd' is still running and/or enabled
when: (ansible_facts.services["ntpd.service"] is defined and ansible_facts.services["ntpd.service"].state == "running") or
(ansible_facts.services["ntpd.service"] is defined and ansible_facts.services["ntpd.service"].status == "enabled")
- name: Ensure chrony is installed
fail:
msg: Package 'chrony' is not installed
when: "'chrony' not in ansible_facts.packages"
- name: Ensure chrony service is enabled and running
fail:
msg: Service 'chronyd' is not running and/or enabled
when:
- ansible_facts.services["chronyd.service"].state != "running"
- ansible_facts.services["chronyd.service"].status != "enabled"
- name: Ensure chrony configuration file exists
file:
path: /etc/chrony.conf
owner: root
group: root
mode: '0644'
check_mode: True
- name: Run command | [ chronyc tracking ] | part 1
command: chronyc tracking
register: role_chrony_verify_command
changed_when: False
- name: Show output | [ chronyc tracking ] | part 2
debug:
msg: "{{ role_chrony_verify_command.stdout.split('\n') }}"
- name: Run command | [ chronyc sources ] | part 1
command: chronyc sources
register: role_chrony_verify_command
changed_when: False
- name: Show output | [ chronyc sources ] | part 2
debug:
msg: "{{ role_chrony_verify_command.stdout.split('\n') }}"
- name: Run command | [ chronyc sourcestats ] | part 1
command: chronyc sourcestats
register: role_chrony_verify_command
changed_when: False
- name: Show output | [ chronyc sourcestats ] | part 2
debug:
msg: "{{ role_chrony_verify_command.stdout.split('\n') }}"
...