From 06034a8b8b7e0925ced91ea0e9264dbce73e210c Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Mon, 27 Jun 2016 10:30:11 +0300 Subject: [PATCH] roles/common: Use systemd's timedatectl for time stuff Debian 8 and Ubuntu 16.04 use systemd, so we can make use of its NTP stuff rather than using the standalone `ntp` package. --- roles/common/tasks/main.yml | 9 +++++++++ roles/common/tasks/packages_Ubuntu.yml | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index b7325db..6c88f70 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -8,6 +8,15 @@ # lineinfile: dest=/etc/hosts insertafter=^127.0.0.1 line='127.0.1.1 {{ inventory_hostname }}' # tags: hostname +- name: Set timezone + when: timezone is defined + command: /usr/bin/timedatectl set-timezone {{ timezone }} + tags: timezone + +- name: Enable NTP + command: /usr/bin/timedatectl set-ntp on + tags: ntp + - include: packages_Ubuntu.yml when: ansible_distribution == 'Ubuntu' tags: packages diff --git a/roles/common/tasks/packages_Ubuntu.yml b/roles/common/tasks/packages_Ubuntu.yml index c2a3675..ef40454 100644 --- a/roles/common/tasks/packages_Ubuntu.yml +++ b/roles/common/tasks/packages_Ubuntu.yml @@ -12,7 +12,6 @@ - name: Install base packages apt: pkg={{ item }} with_items: - - ntp - git - tmux - iotop