22 lines
753 B
YAML
22 lines
753 B
YAML
---
|
|
- name: Manage the timezone in Ubuntu Trusty and older
|
|
block:
|
|
- name: Write the timezone file
|
|
template: src=etc-timezone.j2 dest=/etc/timezone owner=root group=root mode=0644
|
|
register: set_timezone
|
|
|
|
- name: Reconfigure the system tzdata
|
|
command: dpkg-reconfigure --frontend noninteractive tzdata
|
|
when: set_timezone is changed
|
|
|
|
when: ansible_distribution_release == "trusty"
|
|
tags: [ 'systemsetup', 'timezone' ]
|
|
|
|
- name: Manage the timezone in Ubuntu Bionic or CentOS
|
|
block:
|
|
- name: Set the timezone
|
|
command: timedatectl set-timezone {{ timezone }}
|
|
|
|
when: ansible_facts['distribution_version'] is version_compare('16.04', '>=') or ansible_distribution_file_variety == "RedHat"
|
|
tags: [ 'systemsetup', 'timezone' ]
|