Skip to content

Instantly share code, notes, and snippets.

@supaket
Created July 13, 2016 03:24
Show Gist options
  • Save supaket/a82e57543a56b89bc194d6e2137c493c to your computer and use it in GitHub Desktop.
Save supaket/a82e57543a56b89bc194d6e2137c493c to your computer and use it in GitHub Desktop.
Ansible timezone for CentOS
---
- name: Check current timezone
shell: awk -F\" '{ print $2}' /etc/sysconfig/clock
register: current_zone
changed_when: False
- name: Set UTC timezone
file: src=/usr/share/zoneinfo/{{ timezone }} dest=/etc/localtime state=link force=yes
when: current_zone.stdout != '{{ timezone }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment