From e62d8b3ae6c9de9b292f51ddeffda22c23145f9c Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 30 Oct 2019 13:54:01 +0100 Subject: [PATCH] Set the requested timezone on Ubuntu 18.04+ using the timedatectl client. --- library/roles/timezone/tasks/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/roles/timezone/tasks/main.yml b/library/roles/timezone/tasks/main.yml index c48234d..57a0e91 100644 --- a/library/roles/timezone/tasks/main.yml +++ b/library/roles/timezone/tasks/main.yml @@ -1,4 +1,9 @@ --- +- 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