We can use the following code to set a new timezone on AWS EC2 using Ansible.
---
- hosts: linuxservers proxmoxservers
remote_user: ansible
become: yes
tasks:
- name: 'Set timezone to Buenos Aires'
timezone:
name: America/New_York
- name: Ansible date fact example
debug:
msg="{{ lookup('pipe','date +%Y-%m-%d-%H-%M-%S') }}"
After this,
- How do we verify if the current timezone is set to the expected value?
- How to validate the timezone has been changed correctly (to the desired value)?