-
Notifications
You must be signed in to change notification settings - Fork 8
/
verify.yml
66 lines (59 loc) · 1.82 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
---
- name: Verify
hosts: all
tasks:
- name: Include defaults
ansible.builtin.include_vars: "../../defaults/main.yml"
- name: Include OS specific configuration
ansible.builtin.include_vars: "{{ lookup('first_found', findme) }}"
vars:
findme:
paths:
- "../../vars"
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
skip: yes
- name: Retrieve configuration directory state
ansible.builtin.stat:
path: "{{ chrony_config_file | dirname }}"
register: chrony_config_dir
tags:
- "tdd"
- name: Test configuration directory state
ansible.builtin.assert:
that:
- "chrony_config_dir.stat.exists"
- "chrony_config_dir.stat.isdir"
- "chrony_config_dir.stat.mode == '0755'"
- "chrony_config_dir.stat.pw_name == 'root'"
- "chrony_config_dir.stat.gr_name == 'root'"
tags:
- "tdd"
- name: Populate packages facts
ansible.builtin.package_facts:
tags:
- "tdd"
- name: Test package state
ansible.builtin.assert:
that: "'{{ item }}' in ansible_facts.packages"
loop:
- "chrony"
tags:
- "tdd"
- name: Populate services facts
ansible.builtin.service_facts:
tags:
- "tdd"
- name: Test service state
ansible.builtin.assert:
that:
- "'{{ item }}.service' in ansible_facts.services"
- "ansible_facts.services['{{ item }}.service'].state == 'running'"
- "ansible_facts.services['{{ item }}.service'].status == 'enabled'"
loop:
- "{{ chrony_service_name }}"
tags:
- "tdd"
...