Files
oopen-server/roles/common/tasks/ntp.yml
T
chris 81398e847e Refactor Ansible tasks to use fully qualified module names and improve code consistency
- Updated all tasks to use fully qualified module names (e.g., ansible.builtin.shell, ansible.builtin.copy) for clarity and to avoid ambiguity.
- Replaced deprecated 'yum' module with 'dnf' for package management on RedHat-based systems.
- Improved formatting and consistency in task definitions, including the use of double quotes for strings and consistent indentation.
- Removed unnecessary comments and whitespace to enhance readability.
- Ensured that conditions and loops are consistently formatted across all tasks.
2026-07-20 23:09:30 +02:00

57 lines
1.4 KiB
YAML

---
# ---
# NTP Server
# ---
- name: (ntp.yml) Ensure ntpsec package is installed.
ansible.builtin.apt:
name:
- ntpsec
state: present
when:
- ansible_facts.os_family == "Debian"
tags:
- ntp-server
- name: (ntp.yml) Check file '/etc/ntpsec/ntp.conf.ORIG' exists
ansible.builtin.stat:
path: /etc/ntpsec/ntp.conf.ORIG
register: etc_ntpsec_conf_ORIG
when:
- ansible_facts.distribution == "Debian"
tags:
- ntp-server
- name: (ntp.yml) Ensure directory '/var/log/ntpsec' is present
ansible.builtin.file:
path: /var/log/ntpsec
state: directory
owner: ntpsec
group: ntpsec
mode: "0755"
when:
- ansible_facts.distribution == "Debian"
- name: (ntp.yml) Backup installation version of file '/etc/ntpsec/ntp.conf'
ansible.builtin.command: cp /etc/ntpsec/ntp.conf /etc/ntpsec/ntp.conf.ORIG
when:
- groups['oopen_office_server']|string is search(inventory_hostname)
- etc_ntpsec_conf_ORIG.stat.exists == False
- local_ntp_service is defined and local_ntp_service|bool
tags:
- ntp-server
- name: (ntp.yml) Update '/etc/ntpsec/ntp.conf'
ansible.builtin.template:
src: "etc/ntpsec/ntp.conf.j2"
dest: /etc/ntpsec/ntp.conf
owner: root
group: root
mode: "0644"
notify: Restart ntp
when:
- groups['oopen_office_server']|string is search(inventory_hostname)
- local_ntp_service is defined and local_ntp_service|bool
tags:
- ntp-server