Browse Source

Use common_timezone and fix idempotence

Thanks-to: 8e693b3db3

Conflicts:
	roles/common/tasks/main.yml
Laurent Arnoud 9 years ago
parent
commit
1419c4e26e
4 changed files with 16 additions and 5 deletions
  1. 13
    5
      roles/common/tasks/main.yml
  2. 1
    0
      vars/defaults.yml
  3. 1
    0
      vars/testing.yml
  4. 1
    0
      vars/user.yml

+ 13
- 5
roles/common/tasks/main.yml View File

@@ -40,14 +40,22 @@
40 40
   tags:
41 41
     - dependencies
42 42
 
43
-- name: Set timezone to UTC
44
-  action: shell echo Etc/UTC > /etc/timezone
43
+- name: timezone - configure /etc/timezone
44
+  copy:
45
+    content: "{{ common_timezone | regex_replace('$', '\n') }}"
46
+    dest: /etc/timezone
47
+    owner: root
48
+    group: root
49
+    mode: 0644
50
+  register: common_timezone_config
45 51
 
46
-- name: Set localtime to UTC
52
+- name: timezone - Set localtime to UTC
47 53
   file: src=/usr/share/zoneinfo/Etc/UTC dest=/etc/localtime
54
+  when: common_timezone_config.changed
48 55
 
49
-- name: Reconfigure tzdata
50
-  action: command dpkg-reconfigure -f noninteractive tzdata
56
+- name: timezone - reconfigure tzdata
57
+  command: dpkg-reconfigure --frontend noninteractive tzdata
58
+  when: common_timezone_config.changed
51 59
 
52 60
 - name: Apticron email configuration
53 61
   template: src=apticron.conf.j2 dest=/etc/apticron/apticron.conf

+ 1
- 0
vars/defaults.yml View File

@@ -5,6 +5,7 @@
5 5
 ###############################################################################
6 6
 
7 7
 # # common
8
+# common_timezone: 'Etc/UTC' (required)
8 9
 # domain: (required)
9 10
 # main_user_name: (required)
10 11
 admin_email: "{{ main_user_name }}@{{ domain }}"

+ 1
- 0
vars/testing.yml View File

@@ -5,6 +5,7 @@
5 5
 ###############################################################################
6 6
 
7 7
 # common
8
+common_timezone: 'Etc/UTC'
8 9
 domain: sovereign.local
9 10
 main_user_name: sovereign
10 11
 encfs_password: testPassword

+ 1
- 0
vars/user.yml View File

@@ -5,6 +5,7 @@
5 5
 ###############################################################################
6 6
 
7 7
 # common
8
+common_timezone: 'Etc/UTC'
8 9
 domain: TODO.com
9 10
 main_user_name: TODO
10 11
 encfs_password: TODO    # NOTE: must not contain dollar sign characters '$'

Loading…
Cancel
Save