]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
Set timezone for yum systems
authorZack Cerza <zack@redhat.com>
Wed, 20 Jan 2016 17:28:24 +0000 (10:28 -0700)
committerZack Cerza <zack@redhat.com>
Wed, 20 Jan 2016 17:37:11 +0000 (10:37 -0700)
Signed-off-by: Zack Cerza <zack@redhat.com>
roles/common/tasks/yum_systems.yml

index fce55c8431584cb5c88cdcfccb83d7051681a442..931dd816bc68049f449b4ec0dba60869c682e12f 100644 (file)
@@ -1,4 +1,22 @@
 ---
+- name: Get the current timezone
+  shell: cut -d'"' -f2 /etc/sysconfig/clock
+  register: current_tz
+  changed_when: false
+  tags:
+    - timezone
+
+- name: Set the timezone
+  file:
+    src: /usr/share/zoneinfo/{{ timezone }}
+    dest: /etc/localtime
+    state: link
+    force: yes
+  # Default is used below to avoid breaking check mode
+  when: current_tz.stdout|default("") != timezone
+  tags:
+    - timezone
+
 # configure Red Hat entitlements with subscription-manager
 - include: rhel-entitlements.yml
   when: ansible_distribution == 'RedHat'