-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathverify-timezone.yaml
53 lines (40 loc) · 1.7 KB
/
verify-timezone.yaml
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
---
- name: Verify that timezone packages and data are installed
hosts: docker-ready
tasks:
- name: Verify tzdata package is installed
shell: yum list installed tzdata
register: verify_tzdata_installed
when: ansible_distribution == "CentOS"
- name: Verify tzdata-java package is installed
shell: yum list installed tzdata-java
register: verify_tzdata_java_installed
when: ansible_distribution == "CentOS"
- fail: msg="tzdata must be installed"
when: verify_tzdata_installed.rc != 0
- fail: msg="tzdata-java must be installed"
when: verify_tzdata_java_installed.rc != 0
- name: Verify tzdata is up to date
shell: yum check-update tzdata
register: verify_tzdata_uptodate
when: ansible_distribution == "CentOS"
- name: Verify tzdata-java is up to date
shell: yum check-update tzdata-java
register: verify_tzdata_java_uptodate
when: ansible_distribution == "CentOS"
- fail: msg="tzdata must be up to date"
when: verify_tzdata_uptodate.rc != 0
- fail: msg="tzdata-java must be up to date"
when: verify_tzdata_java_uptodate.rc != 0
- name: Verify /etc/localtime exists
stat: path=/etc/localtime
register: verify_etc_localtime
- name: Verify /etc/timezone exists
stat: path=/etc/timezone
register: verify_etc_timezone
- fail: msg="/etc/localtime must exist"
when: not verify_etc_localtime.stat.exists or
verify_etc_localtime.stat.isdir
- fail: msg="/etc/timezone must exist"
when: not verify_etc_timezone.stat.exists or
verify_etc_timezone.stat.isdir