forked from ocp-power-automation/ocp4-playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup Chrony server on bastion node (ocp-power-automation#39)
Fixes ocp-power-automation#38 Signed-off-by: Sebastien Chabrolles <[email protected]>
- Loading branch information
1 parent
d9ed193
commit 54a781e
Showing
7 changed files
with
83 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ no_proxy: "" | |
enable_local_registry: false | ||
|
||
chronyconfig: | ||
enabled: false | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,8 @@ | |
service: | ||
name: firewalld | ||
state: restarted | ||
|
||
- name: restart chrony | ||
service: | ||
name: chronyd | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,72 @@ | ||
- name: Create temporary chrony.conf file | ||
template: | ||
src: chrony.conf.j2 | ||
dest: /tmp/chrony.conf.tmp | ||
- name: Install chrony on bastion | ||
yum: | ||
name: chrony | ||
state: present | ||
|
||
- name: slurp contents of temporary chrony.conf file | ||
slurp: | ||
src: /tmp/chrony.conf.tmp | ||
register: chronybase64 | ||
- name: Open NTP port on firewall | ||
firewalld: | ||
service: ntp | ||
permanent: yes | ||
immediate: yes | ||
state: enabled | ||
|
||
- name: Generate Chrony machineconfig | ||
template: | ||
src: chrony-machineconfig.j2 | ||
dest: "{{ workdir }}/manifests/99-{{item}}-chrony-configuration.yaml" | ||
loop: | ||
- master | ||
- worker | ||
- name: Configure chrony to synchronize with ntp servers | ||
lineinfile: | ||
path: /etc/chrony.conf | ||
regexp: '^server {{ item.server }} ' | ||
state: present | ||
line: "server {{ item.server }} {{ item.options | default('iburst') }}" | ||
insertafter: 'server ' | ||
backup: yes | ||
loop: "{{ chronyconfig.content }}" | ||
when: | ||
- chronyconfig.content is defined | ||
- chronyconfig.content[0].server is defined | ||
notify: | ||
- restart chrony | ||
|
||
- name: Remove Chrony default pool when ntp server are used | ||
lineinfile: | ||
path: /etc/chrony.conf | ||
regexp: '^pool .*\.rhel\.pool\.ntp\.org' | ||
state: absent | ||
backup: yes | ||
when: | ||
- chronyconfig.content is defined | ||
- chronyconfig.content[0].server is defined | ||
notify: | ||
- restart chrony | ||
|
||
- name: Allow local stratum in chrony.conf on bastion | ||
lineinfile: | ||
path: /etc/chrony.conf | ||
regexp: '^local stratum' | ||
state: present | ||
line: "local stratum 10" | ||
insertafter: '^#local stratum' | ||
backup: yes | ||
notify: | ||
- restart chrony | ||
|
||
- name: Allow Cluster Network in chrony.conf on bastion | ||
lineinfile: | ||
path: /etc/chrony.conf | ||
regexp: '^allow' | ||
state: present | ||
line: "allow {{ item }}" | ||
insertafter: '^#allow' | ||
backup: yes | ||
loop: "{{ chronyconfig.allow }}" | ||
when: | ||
- chronyconfig.allow is defined | ||
- chronyconfig.allow[0] is defined | ||
notify: | ||
- restart chrony | ||
|
||
- name: Copy machineconfig files generated from helpernode | ||
copy: | ||
src: "{{ item }}" | ||
dest: "{{ workdir }}/manifests" | ||
remote_src: yes | ||
with_fileglob: | ||
- "../../ocp4-helpernode/machineconfig/*-chrony-configuration.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
playbooks/roles/ocp-config/templates/chrony-machineconfig.j2
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.