From a9ec075ebcc25e248904c9e9074dbd4850d73ec8 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 1 Aug 2024 13:43:36 +0200 Subject: [PATCH] Print the value of ntp_service_install. --- tasks/main.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 03e0f5d..2a16213 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,25 +1,32 @@ --- +- name: Display the value of ntp_service_install + ansible.builtin.debug: + msg: "ntp_service_install: {{ ntp_service_install }}" + - block: - name: Install the ntp server apt: pkg=ntp state=present cache_valid_time=3600 + when: ntp_service_install - name: Install the ntp configuration. template: src=ntp.conf.j2 dest=/etc/ntp.conf owner=root group=root mode=0644 + when: ntp_service_install notify: Restart the ntp server - name: Ensure that the ntp server is running service: name=ntp state=started enabled=yes - when: ntp_service_enabled + when: + - ntp_service_install + - ntp_service_enabled - name: Ensure that the ntp package is not installed ansible.builtin.apt: pkg: ntp state: absent - when: not ntp_service_enabled + when: not ntp_service_install when: - ansible_distribution_file_variety == "Debian" - - ntp_service_install tags: [ 'packages', 'ntp' ] - block: