Skip to content

Commit cefbd9a

Browse files
committed
move compute-init install and configuration all to the end
1 parent 5cc7fbc commit cefbd9a

File tree

3 files changed

+32
-34
lines changed

3 files changed

+32
-34
lines changed

ansible/extras.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,6 @@
5858
- import_role:
5959
name: persist_hostkeys
6060

61-
- name: Install compute_init playbook
62-
hosts: compute_init:&builder
63-
tags: compute_init # tagged to allow running on cluster instances for dev
64-
become: yes
65-
tasks:
66-
- include_role:
67-
name: compute_init
68-
tasks_from: install.yml
69-
70-
- name: Setup NFS export for compute node configuration
71-
hosts: compute_init:!builder
72-
# NB: has to be after eeesi and os-manila-mount
73-
tags: compute_init
74-
become: yes
75-
tasks:
76-
- include_role:
77-
name: compute_init
78-
tasks_from: export.yml
79-
8061
- name: Install k9s
8162
become: yes
8263
hosts: k9s

ansible/final.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
- hosts: compute_init
2+
tags: compute_init
3+
become: yes
4+
tasks:
5+
- name: Install compute_init playbook
6+
ansible.builtin.include_role:
7+
name: compute_init
8+
tasks_from: 'install.yml'
9+
when: "{{ appliances_mode == 'build' }}"
10+
# conditional used instead of compute_init!builder to make dev easier
11+
12+
- hosts: compute_init:!builder
13+
tags: compute_init
14+
become: yes
15+
tasks:
16+
- name: Setup NFS export for compute node configuration
17+
ansible.builtin.include_role:
18+
name: compute_init
19+
tasks_from: export.yml
20+
121
- hosts: dnf_repos
222
become: yes
323
tasks:

ansible/roles/compute_init/README.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,35 +143,32 @@ a new image:
143143
additionally configure the control node to export compute hostvars over NFS.
144144
Check the cluster is up.
145145

146-
2. Reimage the compute nodes:
146+
2. Optionally, reimage the compute nodes to reset services etc.:
147147

148148
ansible-playbook --limit compute ansible/adhoc/rebuild.yml
149149

150-
3. Add metadata to a compute node e.g. via Horizon to turn on compute-init
151-
playbook functionality.
150+
3. Add metadata to a compute node (directly via Horizon or via OpenTofu) to
151+
enable the new compute-init playbook functionality.
152152

153-
4. Stop ansible-init from running
153+
4. Stop ansible-init from running:
154154

155155
ansible all -ba "systemctl stop ansible-init"
156156

157-
5. Fake an image build to deploy the compute-init playbook:
157+
5. Fake an image build and rerunning the `site.yml` playbook:
158158

159-
ansible-playbook ansible/fatimage.yml --tags compute_init
159+
ansible-playbook ansible/final.yml --tags compute_init
160160

161-
NB: This will also re-export the compute hostvars, as the nodes are not
162-
in the builder group, which conveniently means any changes made to that
163-
play also get picked up.
161+
This both re-installs the compute-init playbook and re-configures the NFS
162+
share with exported compute hostvars etc.
164163

165-
6. Fake a reimage of compute to run ansible-init and the updated compute-init playbook:
164+
6. Fake a reimage of compute nodes to re-run ansible-init and the updated
165+
compute-init playbook:
166166

167167
ansible all -ba "rm -f /var/lib/ansible-init.done && systemctl restart ansible-init"
168168

169-
Use `systemctl status ansible-init` to view stdout/stderr from Ansible.
170-
171-
Steps 4/5/6 can be repeated with changes to the compute script. If required,
172-
reimage the compute node(s) first as in step 2 and/or add additional metadata
173-
as in step 3.
169+
7. Use `systemctl status ansible-init` to view stdout/stderr from Ansible.
174170

171+
Steps 4-7 can be repeated with changes to the compute script until it works.
175172

176173
## Design notes
177174
- Duplicating code in roles into the `compute-init` script is unfortunate, but

0 commit comments

Comments
 (0)