]> git.somenet.org - root/pub/somesible.git/blob - roles/base/ntp/tasks/main.yml
roles/service/mattermost/defaults
[root/pub/somesible.git] / roles / base / ntp / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: install chrony
9   apt:
10     pkg:
11     - chrony
12     state: present
13     policy_rc_d: 101
14   tags: "online"
15   ignore_errors: "{{ignore_online_errors | bool}}"
16
17
18 - name: copy config
19   copy:
20     src: "{{item}}"
21     dest: "/etc/chrony/chrony.conf"
22   with_first_found:
23     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/chrony.conf"
24     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/chrony.conf"
25     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/chrony.conf"
26     - "default/chrony.{{ntpd_type}}.conf"
27   notify: restart chrony.service
28
29
30 - name: copy chrony.service to /etc/systemd/system/
31   copy:
32     src: "{{item}}"
33     dest: "/etc/systemd/system/chrony.service"
34     mode: 0644
35     owner: "root"
36     group: "root"
37   with_first_found:
38     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/chrony.service"
39     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/chrony.service"
40     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/chrony.service"
41     - "default/chrony.service"
42   notify: restart chrony.service
43
44
45 - name: enable and start chrony.service
46   include_role: name="base/systemd/enable-and-start"
47   vars:
48     service_name: chrony.service
49
50
51 - name: disable and mask systemd-timesyncd.service
52   systemd:
53     name: systemd-timesyncd.service
54     daemon_reload: yes
55     enabled: no
56     masked: yes
57   # may have been removed by ntp install. sometimes not.
58   ignore_errors: yes