Skip to content

Commit 673ef13

Browse files
jovialsjpb
andauthored
Adds support for configuring chrony (#575)
* Adds support for configuring chrony Chrony is already bundled in the generic cloud image so we just have to configure it. For this I am using an off the shelf role. I've chosen mrlesmithjr.chrony as it is also used in kayobe (so we can share development effort) * Add chrony to default inventory * Try and test with CI * Correct role name * Update bootstrap.yml * Address comments from code review --------- Co-authored-by: Steve Brasier <[email protected]>
1 parent d474a4f commit 673ef13

File tree

10 files changed

+49
-1
lines changed

10 files changed

+49
-1
lines changed

ansible/bootstrap.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
- import_role:
5353
name: proxy
5454

55+
- hosts: chrony
56+
tags: chrony
57+
become: yes
58+
tasks:
59+
- import_role:
60+
name: mrlesmithjr.chrony
61+
5562
- hosts: cluster
5663
gather_facts: false
5764
become: yes

ansible/roles/compute_init/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ it also requires an image build with the role name added to the
4343
| bootstrap.yml | (wait for ansible-init) | Not relevant during boot | n/a |
4444
| bootstrap.yml | resolv_conf | Fully supported | No |
4545
| bootstrap.yml | etc_hosts | Fully supported | No |
46+
| bootstrap.yml | chrony | Fully supported | No |
4647
| bootstrap.yml | proxy | None at present | No |
4748
| bootstrap.yml | (/etc permissions) | None required - use image build | No |
4849
| bootstrap.yml | (ssh /home fix) | None required - use image build | No |

ansible/roles/compute_init/files/compute-init.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
enable_manila: "{{ os_metadata.meta.manila | default(false) | bool }}"
1818
enable_basic_users: "{{ os_metadata.meta.basic_users | default(false) | bool }}"
1919
enable_eessi: "{{ os_metadata.meta.eessi | default(false) | bool }}"
20+
enable_chrony: "{{ os_metadata.meta.chrony | default(false) | bool }}"
2021

2122
# TODO: "= role defaults" - could be moved to a vars_file: on play with similar precedence effects
2223
resolv_conf_nameservers: []
@@ -100,6 +101,11 @@
100101

101102
# TODO: should /mnt/cluster now be UNMOUNTED to avoid future hang-ups?
102103

104+
- name: Run chrony role
105+
ansible.builtin.include_role:
106+
name: mrlesmithjr.chrony
107+
when: enable_chrony | bool
108+
103109
- name: Configure resolve.conf
104110
block:
105111
- name: Set nameservers in /etc/resolv.conf

ansible/roles/compute_init/tasks/install.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
dest: tasks/tuned.yml
4444
- src: ../../stackhpc.nfs/tasks/nfs-clients.yml
4545
dest: tasks/nfs-clients.yml
46+
- src: ../../mrlesmithjr.chrony
47+
dest: roles/
4648

4749
- name: Add filter_plugins to ansible.cfg
4850
lineinfile:

docs/chrony.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Chrony configuration
2+
3+
Use variables from the [mrlesmithjr.chrony](https://github.com/mrlesmithjr/ansible-chrony) role.
4+
5+
For example in: `environments/<environment>/inventory/group_vars/all/chrony`:
6+
7+
```
8+
---
9+
chrony_ntp_servers:
10+
- server: ntp-0.example.org
11+
options:
12+
- option: iburst
13+
- option: minpoll
14+
val: 8
15+
- server: ntp-1.example.org
16+
options:
17+
- option: iburst
18+
- option: minpoll
19+
val: 8
20+
21+
```

environments/.stackhpc/inventory/extra_groups

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ cluster
2424
login
2525
compute
2626

27+
[chrony:children]
28+
cluster
29+
2730
[tuned:children]
2831
# Install tuned into fat image
2932
builder

environments/.stackhpc/tofu/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module "cluster" {
8080
standard: { # NB: can't call this default!
8181
nodes: ["compute-0", "compute-1"]
8282
flavor: var.other_node_flavor
83-
compute_init_enable: ["compute", "etc_hosts", "nfs", "basic_users", "eessi", "tuned", "cacerts"]
83+
compute_init_enable: ["compute", "chrony", "etc_hosts", "nfs", "basic_users", "eessi", "tuned", "cacerts"]
8484
ignore_image_changes: true
8585
}
8686
# Example of how to add another partition:

environments/common/inventory/groups

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,6 @@ extra_packages
168168

169169
[cacerts]
170170
# Hosts to configure CA certificates and trusts on
171+
172+
[chrony]
173+
# Hosts where crony configuration is applied. See docs/chrony.md for more details.

environments/common/layouts/everything

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,6 @@ builder
113113

114114
[cacerts]
115115
# Hosts to configure CA certificates and trusts on
116+
117+
[chrony]
118+
# Hosts where crony configuration is applied. See docs/chrony.md for more details.

requirements.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ roles:
2222
- src: https://github.com/stackhpc/ansible-role-os-manila-mount.git
2323
name: stackhpc.os-manila-mount
2424
version: v25.1.1
25+
- src: mrlesmithjr.chrony
26+
version: v0.1.4
2527

2628
collections:
2729
- name: containers.podman

0 commit comments

Comments
 (0)