Skip to content

Commit c24717d

Browse files
authored
Compute-init: Optimise dir copies + Numerical sort playbook + new nodes to existing cluster (#611)
* update docs for compute-init dev * allow numerical sort of compute-init playbook * optimise copy of directories in compute-init * bump images * compute init functionality for new nodes added to existing cluster * bump images
1 parent 4de2d41 commit c24717d

File tree

4 files changed

+31
-14
lines changed

4 files changed

+31
-14
lines changed

ansible/roles/compute_init/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,24 +151,25 @@ a new image:
151151
3. Add metadata to a compute node e.g. via Horizon to turn on compute-init
152152
playbook functionality.
153153

154-
4. Fake an image build to deploy the compute-init playbook:
154+
4. Stop ansible-init from running
155+
156+
ansible all -ba "systemctl stop ansible-init"
157+
158+
5. Fake an image build to deploy the compute-init playbook:
155159

156160
ansible-playbook ansible/fatimage.yml --tags compute_init
157161

158162
NB: This will also re-export the compute hostvars, as the nodes are not
159163
in the builder group, which conveniently means any changes made to that
160164
play also get picked up.
161165

162-
5. Fake a reimage of compute to run ansible-init and the compute-init playbook:
163-
164-
On compute node where metadata was added:
166+
6. Fake a reimage of compute to run ansible-init and the updated compute-init playbook:
165167

166-
[root@rl9-compute-0 rocky]# rm -f /var/lib/ansible-init.done && systemctl restart ansible-init
167-
[root@rl9-compute-0 rocky]# systemctl status ansible-init
168+
ansible all -ba "rm -f /var/lib/ansible-init.done && systemctl restart ansible-init"
168169

169170
Use `systemctl status ansible-init` to view stdout/stderr from Ansible.
170171

171-
Steps 4/5 can be repeated with changes to the compute script. If required,
172+
Steps 4/5/6 can be repeated with changes to the compute script. If required,
172173
reimage the compute node(s) first as in step 2 and/or add additional metadata
173174
as in step 3.
174175

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,20 @@
9595
- meta: end_play
9696
when: _mount_mnt_cluster.failed
9797

98+
- name: Check if hostvars exist
99+
stat:
100+
path: "/mnt/cluster/hostvars/{{ ansible_hostname }}/hostvars.yml"
101+
register: hostvars_stat
102+
103+
- block:
104+
- name: Report skipping initialization if host vars does not exist
105+
# meta: end_play produces no output
106+
debug:
107+
msg: "Skipping compute initialization: hostvars does not exist"
108+
109+
- meta: end_play
110+
when: not hostvars_stat.stat.exists
111+
98112
- name: Load hostvars from NFS
99113
# this is higher priority than vars block = normal ansible's hostvars
100114
include_vars:

ansible/roles/compute_init/tasks/install.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
- roles
1717

1818
- name: Inject files from roles
19-
copy:
19+
synchronize:
2020
src: '{{ item.src }}'
2121
dest: '/etc/ansible-init/playbooks/{{ item.dest }}'
22-
owner: root
23-
group: root
24-
mode: 0644
22+
archive: false
23+
rsync_opts: ["-p", "--chmod=D770,F644", "--owner=root", "--group=root"]
24+
recursive: true
25+
use_ssh_args: true
26+
become: true
2527
loop:
2628
- src: ../../resolv_conf/templates/resolv.conf.j2
2729
dest: templates/resolv.conf.j2
@@ -60,7 +62,7 @@
6062
- name: Add compute initialisation playbook
6163
copy:
6264
src: compute-init.yml
63-
dest: /etc/ansible-init/playbooks/1-compute-init.yml
65+
dest: /etc/ansible-init/playbooks/10-compute-init.yml
6466
owner: root
6567
group: root
6668
mode: 0644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"cluster_image": {
3-
"RL8": "openhpc-RL8-250305-1110-534ed276",
4-
"RL9": "openhpc-RL9-250305-1110-534ed276"
3+
"RL8": "openhpc-RL8-250311-1020-d05208bc",
4+
"RL9": "openhpc-RL9-250311-1020-d05208bc"
55
}
66
}

0 commit comments

Comments
 (0)