Print the value of ntp_service_install.

This commit is contained in:
Andrea Dell'Amico 2024-08-01 13:43:36 +02:00
parent 7640d6379e
commit a9ec075ebc
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
1 changed files with 10 additions and 3 deletions

View File

@ -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: