3.3. Script - Setting Timezone through Ansible¶
To update a server’s (or server group) timezone add this to a yml script file.
1 2 3 4 5 6 7 8 9 10 11 | ---
- hosts: linuxservers proxmoxservers
remote_user: ansible
become: yes
tasks:
- name: 'Set timezone to Buenos Aires'
timezone:
name: America/Argentina/Buenos_Aires
- name: Ansible date fact example
debug:
msg="{{ lookup('pipe','date +%Y-%m-%d-%H-%M-%S')}}"
|
And execute it on the console
$ ansible-playbook timezone.yml -K