Bartek Grzybowski | 30b2cbf | 2019-03-26 16:10:10 +0100 | [diff] [blame^] | 1 | --- |
| 2 | - name: Check if server mode |
| 3 | set_fact: |
| 4 | chrony_mode: 'server' |
| 5 | when: "'infrastructure' in group_names and timesync.servers is not defined" |
| 6 | |
| 7 | - name: Check if client mode |
| 8 | set_fact: |
| 9 | chrony_mode: 'client' |
| 10 | when: "timesync.servers is defined or 'infrastructure' not in group_names" |
| 11 | |
| 12 | - name: "Upload chronyd {{ chrony_mode }} configuration" |
| 13 | template: |
| 14 | src: "chrony.conf.j2" |
| 15 | dest: "{{ chrony['conf'][ansible_os_family]['config_file'] }}" |
| 16 | notify: Restart chronyd |
| 17 | |
| 18 | - name: Ensure chronyd is enabled/running |
| 19 | systemd: |
| 20 | name: chronyd |
| 21 | state: started |
| 22 | enabled: true |
| 23 | |
| 24 | - name: Setup timezone |
| 25 | timezone: |
| 26 | name: "{{ chrony.timezone }}" |