Ansible roles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.7 KiB

---
- name: Check if systemd-timesyncd is available
stat: path=/lib/systemd/systemd-timesyncd
register: systemd_timesyncd
tags: ntp
- name: Disable systemd-timesyncd
service: name=systemd-timesyncd state=stopped enabled=False
when: systemd_timesyncd.stat.exists
tags: ntp
- name: Check if samba expose ntp_signd socket
stat: path=/var/lib/samba/ntp_signd/socket
register: ntp_samba_signd
tags: ntp
- include_tasks: install_{{ ansible_os_family }}.yml
tags: ntp
- name: Deploy ntp configuration
template: src=ntp.conf.j2 dest=/etc/ntp.conf
notify: restart ntpd
when: samba_role is defined and (samba_role == 'dc' or samba_role == 'rodc')
tags: ntp
- name: Handle ntpd port
iptables_raw:
name: ntpd_port
state: absent
when: iptables_manage | default(True)
tags: ntp
- name: Check if ntpd is installed
stat: path=/lib/systemd/system/{{ ntp_service }}.service
register: ntp_unit
tags: ntp
# Samba DC use ntpd, all the other can shut it down and use chrony only
- name: Handle ntpd service
service:
name: "{{ ntp_service }}"
state: "{{ (samba_role is defined and (samba_role == 'dc' or samba_role == 'rodc')) | ternary('started','stopped') }}"
enabled: "{{ (samba_role is defined and (samba_role == 'dc' or samba_role == 'rodc')) | ternary(True,False) }}"
when: ntp_unit.stat.exists
tags: ntp
- name: start and enable chrony
service:
name: "{{ chrony_service }}"
state: "{{ (samba_role is defined and (samba_role == 'dc' or samba_role == 'rodc')) | ternary('stopped','started') }}"
enabled: "{{ (samba_role is defined and (samba_role == 'dc' or samba_role == 'rodc')) | ternary(False,True) }}"
tags: ntp
...