From 2ad3342909f7da0515c484c7a7df476b7735f43e Mon Sep 17 00:00:00 2001 From: mg Date: Thu, 1 Apr 2021 18:40:35 +0200 Subject: [PATCH] chrony: Bugfix: masked ntp (#56) chrony: Bugfix: masked ntp - client chrony: Bugfix: masked ntp - server Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/56 Co-Authored-By: mg Co-Committed-By: mg --- roles/mgrote.ntp_chrony_client/handlers/main.yml | 6 ------ roles/mgrote.ntp_chrony_client/tasks/main.yml | 10 ++++++++-- roles/mgrote.ntp_chrony_server/handlers/main.yml | 6 ------ roles/mgrote.ntp_chrony_server/tasks/main.yml | 10 ++++++++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/roles/mgrote.ntp_chrony_client/handlers/main.yml b/roles/mgrote.ntp_chrony_client/handlers/main.yml index f1c7c2d2..f62bf2d0 100644 --- a/roles/mgrote.ntp_chrony_client/handlers/main.yml +++ b/roles/mgrote.ntp_chrony_client/handlers/main.yml @@ -4,9 +4,3 @@ name: chrony enabled: yes state: restarted - - - name: mask ntp service - become: yes - systemd: - name: ntp - masked: yes diff --git a/roles/mgrote.ntp_chrony_client/tasks/main.yml b/roles/mgrote.ntp_chrony_client/tasks/main.yml index 27864329..6470379d 100644 --- a/roles/mgrote.ntp_chrony_client/tasks/main.yml +++ b/roles/mgrote.ntp_chrony_client/tasks/main.yml @@ -6,12 +6,18 @@ state: stopped masked: yes - - name: stop ntp service + - name: gather package facts + become: yes + ansible.builtin.package_facts: + manager: auto + + - name: stop and mask ntp service become: yes systemd: name: ntp + masked: yes state: stopped - notify: mask ntp service + when: "'ntp' in ansible_facts.packages" - name: install chrony packages become: yes diff --git a/roles/mgrote.ntp_chrony_server/handlers/main.yml b/roles/mgrote.ntp_chrony_server/handlers/main.yml index f1c7c2d2..f62bf2d0 100644 --- a/roles/mgrote.ntp_chrony_server/handlers/main.yml +++ b/roles/mgrote.ntp_chrony_server/handlers/main.yml @@ -4,9 +4,3 @@ name: chrony enabled: yes state: restarted - - - name: mask ntp service - become: yes - systemd: - name: ntp - masked: yes diff --git a/roles/mgrote.ntp_chrony_server/tasks/main.yml b/roles/mgrote.ntp_chrony_server/tasks/main.yml index b7fcff84..2b9f7135 100644 --- a/roles/mgrote.ntp_chrony_server/tasks/main.yml +++ b/roles/mgrote.ntp_chrony_server/tasks/main.yml @@ -6,12 +6,18 @@ state: stopped masked: yes - - name: stop ntp service + - name: gather package facts + become: yes + ansible.builtin.package_facts: + manager: auto + + - name: stop and mask ntp service become: yes systemd: name: ntp + masked: yes state: stopped - notify: mask ntp service + when: "'ntp' in ansible_facts.packages" - name: install chrony packages become: yes