Hi
Following is the script to change the timezone in ec2-instance
vars:
-
timezone: Canada/Eastern
-
name: Check current timezone
shell: awk -F" ‘{ print $2}’ /etc/sysconfig/clock
register: current_zone
changed_when: False
- name: Set EST timezone
file: src=/usr/share/zoneinfo/{{ timezone }} dest=/etc/localtime state=link force=yes
when: current_zone.stdout != ‘{{ timezone }}’
i wanted to replace the following /etc/sysconfig/clock UTC entry with variable value defined above. Can someone help me with steps in ansible or shell command to replace the zone ? Thanks in advance.
$ cat /etc/sysconfig/clock
ZONE=“UTC” # UTC to be replaced with Canada/Eastern
UTC=true