From d73f54e7e56f689fa3dc69e5a54f078c9680c337 Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing Date: Wed, 3 Oct 2018 15:31:49 +0200 Subject: debian: add basic Debian role --- roles/debian/tasks/timesyncd.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 roles/debian/tasks/timesyncd.yml (limited to 'roles/debian/tasks/timesyncd.yml') diff --git a/roles/debian/tasks/timesyncd.yml b/roles/debian/tasks/timesyncd.yml new file mode 100644 index 0000000..63949fc --- /dev/null +++ b/roles/debian/tasks/timesyncd.yml @@ -0,0 +1,25 @@ +--- +- name: Configure systemd-timesyncd + ini_file: + path: '/etc/systemd/timesyncd.conf' + no_extra_spaces: yes + section: "{{ item.key.split('.',1)[0] }}" + option: "{{ item.key.split('.',1)[1] }}" + value: "{{ item.value|ternary(item.value,omit) }}" + state: "{{ item.value|ternary('present','absent') }}" + with_dict: '{{ timesyncd_conf }}' + when: use_timesyncd + notify: restart timesyncd + +- name: Enable systemd-timesyncd + systemd: + name: systemd-timesyncd.service + enabled: "{{ use_timesyncd|ternary('yes','no') }}" + masked: no + state: "{{ use_timesyncd|ternary('started','stopped') }}" + when: not chroot +- name: '- when in chroot' + command: systemctl enable systemd-timesyncd.service + when: chroot + +# vim: set ts=2 sw=2 et: -- cgit v1.2.1