From 5b5a40ba40032b5cc36d4ff4f495dafa1b082bf6 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 20 Jan 2016 10:28:24 -0700 Subject: [PATCH] Set timezone for yum systems Signed-off-by: Zack Cerza --- roles/common/tasks/yum_systems.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/roles/common/tasks/yum_systems.yml b/roles/common/tasks/yum_systems.yml index fce55c8..931dd81 100644 --- a/roles/common/tasks/yum_systems.yml +++ b/roles/common/tasks/yum_systems.yml @@ -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' -- 2.39.5