diff options
author | Jirayut Nimsaeng <wingth@gmail.com> | 2017-05-09 15:40:39 +0700 |
---|---|---|
committer | Jirayut Nimsaeng <wingth@gmail.com> | 2017-05-11 11:25:39 +0700 |
commit | be80a0add73c8942405b5bc8ef68ca8d6de9fba5 (patch) | |
tree | ee7067cc5c3fd15b35af315a39cc574fe79e8287 | |
parent | fbd7badf560bb0a18736acaa3ec6416863c0a615 (diff) | |
download | ntp-be80a0add73c8942405b5bc8ef68ca8d6de9fba5.tar.gz ntp-be80a0add73c8942405b5bc8ef68ca8d6de9fba5.tar.bz2 ntp-be80a0add73c8942405b5bc8ef68ca8d6de9fba5.tar.xz ntp-be80a0add73c8942405b5bc8ef68ca8d6de9fba5.zip |
Use timezone module for Ansible 2.2+
-rw-r--r-- | tasks/main.yml | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tasks/main.yml b/tasks/main.yml index afe3731..491c04d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,20 +2,28 @@ - name: Include OS-specific variables. include_vars: "{{ ansible_os_family }}.yml" -- name: Set the correct timezone. +- name: Configure timezone (For Ansible 2.2+) + timezone: + name: "{{ ntp_timezone }}" + when: ansible_version.full >= "02.02.00.00" + +- name: Set the correct timezone. (For Ansible prior 2.2) file: src: "/usr/share/zoneinfo/{{ ntp_timezone }}" dest: /etc/localtime state: link force: yes + when: ansible_version.full < "02.02.00.00" # Debian family OSes also have an /etc/timezone file. -- name: Set timezone in /etc/timezone file. +- name: Set timezone in /etc/timezone file. (For Ansible prior 2.2) template: src: timezone.j2 dest: /etc/timezone force: yes - when: ansible_os_family == 'Debian' + when: + - ansible_os_family == 'Debian' + - ansible_version.full < "02.02.00.00" - name: Install NTP. package: |