added service_facts.

disabling chrony service onlfy if defined
This commit is contained in:
135
2023-08-31 11:45:00 +03:00
parent 4f93502f50
commit 22f3718c7e

View File

@@ -5,6 +5,9 @@
community.general.timezone:
name: "{{ timezone }}"
- name: "populate service facts"
ansible.builtin.service_facts:
- name: "install systemd-timesyncd"
apt:
name: "systemd-timesyncd"
@@ -21,6 +24,7 @@
- { 'regexp': '^#*FallbackNTP=.*$', 'line': 'FallbackNTP={{ fallback_ntp | default("") | join(" ") }}'}
- name: "stop and disable chronyd"
when: ansible_facts.services['chrony.service'] is defined
service:
name: chrony.service
enabled: no