Skip to content

Commit

Permalink
cluster_setup_network: correct timemaster restart
Browse files Browse the repository at this point in the history
The restart of the timemaster service should only happen if the variable
`apply_network_config` is to true.
Otherwise it will happen during the reboot at the end of the playbook.

Signed-off-by: Erwann Roussy <[email protected]>
  • Loading branch information
eroussy committed Mar 22, 2024
1 parent 8fd20a7 commit 0d10205
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions playbooks/cluster_setup_network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@
- cluster_machines
- standalone_machine
become: true
vars:
apply_config: "{{ apply_network_config | default(false) }}"
tasks:
- name: Populate service facts
service_facts:
Expand Down Expand Up @@ -215,17 +217,19 @@
src: ../templates/timemaster.service.j2
dest: /etc/systemd/system/timemaster.service.d/override.conf
register: timemasterconf3
- name: start and enable timemaster
- name: Enable timemaster
service:
name: "timemaster"
state: started
enabled: true
- name: restart timemaster if necessary
service:
name: "timemaster"
state: restarted
enabled: true
when: timemasterconf1.changed or timemasterconf2.changed or timemasterconf3.changed
daemon_reload: true
when:
- timemasterconf1.changed or timemasterconf2.changed or timemasterconf3.changed
- apply_config or (need_reboot is defined and not need_reboot)

- name: Stop chrony service if running
hosts:
Expand Down

0 comments on commit 0d10205

Please sign in to comment.