ansible-roles/library/roles/timezone/tasks/main.yml

17 lines
491 B
YAML

---
- name: Set the timezone on Ubuntu >=18
command: timedatectl set-timezone {{ timezone }}
when: ansible_distribution_version is version_compare('18.04', '>=')
tags: timezone
- name: Write the timezone file
template: src=etc-timezone.j2 dest=/etc/timezone owner=root group=root mode=0644
register: set_timezone
tags: timezone
- name: Reconfigure the system tzdata
command: dpkg-reconfigure --frontend noninteractive tzdata
when: set_timezone is changed
tags: timezone