forked from CCCHH/ansible-infra
44 lines
1.4 KiB
YAML
44 lines
1.4 KiB
YAML
---
|
|
# Copyright (C) 2014-2017 Maciej Delmanowski <drybjed@gmail.com>
|
|
# Copyright (C) 2015-2017 Robin Schneider <ypid@riseup.net>
|
|
# Copyright (C) 2014-2017 DebOps <https://debops.org/>
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
- name: Import DebOps global handlers
|
|
ansible.builtin.import_role:
|
|
name: 'global_handlers'
|
|
|
|
- name: Ensure that configuration is supported
|
|
ansible.builtin.assert:
|
|
that: not ntp__daemon or ntp__daemon in [ 'chrony', 'ntpd', 'ntpdate', 'openntpd', 'systemd-timesyncd' ]
|
|
|
|
- name: Ensure that alternative daemons/programs are not installed
|
|
ansible.builtin.apt:
|
|
name: '{{ ntp__purge_packages | flatten }}'
|
|
state: 'absent'
|
|
purge: True
|
|
register: ntp__register_apt_purge
|
|
until: ntp__register_apt_purge is succeeded
|
|
when: ntp__daemon_enabled | bool
|
|
|
|
# Installs either ntpdate, NTPd, chrony or OpenNTPd on all hosts except inside containers
|
|
- name: Install NTP service
|
|
ansible.builtin.include_tasks: install.yml
|
|
when: ntp__daemon_enabled | bool
|
|
|
|
- name: Make sure that Ansible local facts directory exists
|
|
ansible.builtin.file:
|
|
path: '/etc/ansible/facts.d'
|
|
state: 'directory'
|
|
owner: 'root'
|
|
group: 'root'
|
|
mode: '0755'
|
|
|
|
- name: Save ntp local facts
|
|
ansible.builtin.template:
|
|
src: 'etc/ansible/facts.d/ntp.fact.j2'
|
|
dest: '/etc/ansible/facts.d/ntp.fact'
|
|
owner: 'root'
|
|
group: 'root'
|
|
mode: '0644'
|
|
tags: [ 'meta::facts' ]
|