]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
Set timezone for apt systems
authorZack Cerza <zack@redhat.com>
Wed, 20 Jan 2016 17:36:56 +0000 (10:36 -0700)
committerZack Cerza <zack@redhat.com>
Wed, 20 Jan 2016 17:40:11 +0000 (10:40 -0700)
Signed-off-by: Zack Cerza <zack@redhat.com>
roles/common/tasks/apt_systems.yml [new file with mode: 0644]
roles/common/tasks/main.yml

diff --git a/roles/common/tasks/apt_systems.yml b/roles/common/tasks/apt_systems.yml
new file mode 100644 (file)
index 0000000..619be91
--- /dev/null
@@ -0,0 +1,26 @@
+---
+- name: Get the current timezone
+  shell: cat /etc/timezone
+  register: current_tz
+  changed_when: false
+  tags:
+    - timezone
+
+- name: Set the timezone in /etc/timezone
+  copy:
+    content: "{{ timezone }}"
+    dest: /etc/timezone
+    owner: root
+    group: root
+    mode: 0644
+  # Default is used below to avoid breaking check mode
+  when: current_tz.stdout|default("") != timezone
+  register: etc_timezone
+  tags:
+    - timezone
+
+- name: Inform the OS of the new timezone
+  command: dpkg-reconfigure --frontend noninteractive tzdata
+  when: etc_timezone|changed
+  tags:
+    - timezone
index bfb22a9bc5326daf24a25965013c83a24eff94a7..bf065e3a706d05bfa2bafa99ddea1ccd6b450497 100644 (file)
 - include: yum_systems.yml
   when: ansible_pkg_mgr == "yum"
 
+# configure things specific to apt systems
+- include: apt_systems.yml
+  when: ansible_pkg_mgr == "apt"
+
 # configure Kerberos
 - include: kerberos.yml
   tags: