Skip to content

Commit deab8e8

Browse files
authored
Support clusters with no outbound internet (#717)
1 parent d8f490f commit deab8e8

File tree

40 files changed

+460
-147
lines changed

40 files changed

+460
-147
lines changed

ansible/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,5 @@ roles/*
9494
!roles/slurm_recompile/**
9595
!roles/nhc/
9696
!roles/nhc/**
97+
!roles/eessi/
98+
!roles/eessi/**

ansible/bootstrap.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,9 @@
186186
become: yes
187187
tasks:
188188
- name: Install and configure tuneD
189-
import_role:
189+
include_role:
190190
name: tuned
191+
tasks_from: "{{ 'configure.yml' if appliances_mode == 'configure' else 'main.yml' }}"
191192

192193
- hosts: freeipa_server
193194
# Done here as it might be providing DNS
@@ -217,31 +218,27 @@
217218
become: yes
218219
tags: firewalld
219220
tasks:
220-
- import_role:
221+
- include_role:
221222
name: firewalld
223+
tasks_from: "{{ 'runtime.yml' if appliances_mode == 'configure' else 'main.yml' }}"
222224

223225
- hosts: fail2ban
224226
gather_facts: false
225227
become: yes
226228
tags: fail2ban
227229
tasks:
228-
- import_role:
230+
- include_role:
229231
name: fail2ban
232+
tasks_from: "{{ 'configure.yml' if appliances_mode == 'configure' else 'main.yml' }}"
230233

231234
- name: Setup podman
232235
gather_facts: false
233236
hosts: podman
234237
tags: podman
235238
tasks:
236-
- import_role:
237-
name: podman
238-
tasks_from: prereqs.yml
239-
tags: prereqs
240-
241-
- import_role:
239+
- include_role:
242240
name: podman
243-
tasks_from: config.yml
244-
tags: config
241+
tasks_from: "{{ 'configure.yml' if appliances_mode == 'configure' else 'main.yml' }}"
245242

246243
- hosts: update
247244
gather_facts: false
@@ -317,8 +314,10 @@
317314
become: yes
318315
tags: linux_ansible_init
319316
tasks:
320-
- include_role:
317+
- name: Install ansible-init
318+
include_role:
321319
name: azimuth_cloud.image_utils.linux_ansible_init
320+
when: "appliances_mode == 'build'"
322321

323322
- hosts: k3s:&builder
324323
become: yes

ansible/extras.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@
3434
become: true
3535
gather_facts: false
3636
tasks:
37-
- name: Install and configure EESSI
38-
import_role:
37+
- name: Install / configure EESSI
38+
include_role:
3939
name: eessi
40+
tasks_from: "{{ 'configure.yml' if appliances_mode == 'configure' else 'main.yml' }}"
4041

4142
- name: Setup CUDA
4243
hosts: cuda

ansible/fatimage.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@
108108
tasks_from: install.yml
109109
when: "'mysql' in group_names"
110110

111-
- name: OpenHPC
111+
- name: Install rebuild
112+
include_role:
113+
name: rebuild
114+
tasks_from: install.yml
115+
116+
- name: Install OpenHPC
112117
import_role:
113118
name: stackhpc.openhpc
114119
tasks_from: install.yml
@@ -134,7 +139,6 @@
134139
import_role:
135140
name: openondemand
136141
tasks_from: vnc_compute.yml
137-
138142
when: "'openondemand_desktop' in group_names"
139143

140144
- name: Open Ondemand jupyter node
@@ -153,7 +157,11 @@
153157
tasks_from: install.yml
154158
when: "'opensearch' in group_names"
155159

156-
# slurm_stats - nothing to do
160+
- import_role:
161+
name: slurm_stats
162+
tasks_from: install.yml
163+
when: "'slurm_stats' in group_names"
164+
157165
- import_role:
158166
name: filebeat
159167
tasks_from: install.yml
@@ -171,11 +179,9 @@
171179
when: "'openondemand' in group_names"
172180

173181
- name: slurm exporter
174-
import_role:
182+
include_role:
175183
name: slurm_exporter
176-
tasks_from: install
177-
vars:
178-
slurm_exporter_state: stopped
184+
tasks_from: install.yml
179185
when: "'slurm_exporter' in group_names"
180186

181187
- name: Install alertmanager
@@ -249,6 +255,11 @@
249255
- import_role:
250256
name: cloudalchemy.grafana
251257
tasks_from: install.yml
258+
- import_role:
259+
name: cloudalchemy.grafana
260+
tasks_from: plugins.yml
261+
- include_role: # done in same play so it can use handlers from cloudalchemy.grafana
262+
name: grafana-dashboards
252263

253264
- name: Add support for NVIDIA GPU auto detection to Slurm
254265
hosts: cuda

ansible/filesystems.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
tasks:
2525
- include_role:
2626
name: stackhpc.os-manila-mount
27+
tasks_from: "{{ item }}"
28+
loop: "{{ ['lookup.yml', 'mount.yml'] if appliances_mode == 'configure' else ['main.yml'] }}"
2729

2830
- name: Setup Lustre clients
2931
hosts: lustre

ansible/final.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@
1717
- include_role:
1818
name: compute_init
1919
tasks_from: export.yml
20+
21+
- hosts: proxy
22+
gather_facts: false
23+
tags: proxy
24+
become: yes
25+
tasks:
26+
- include_role:
27+
name: proxy
28+
vars:
29+
proxy_state: absent
30+
when: proxy_remove | default(false) | bool == true

ansible/iam.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
become: yes
2121
tasks:
2222
- name: Install FreeIPA client
23-
import_role:
23+
include_role:
2424
name: freeipa
2525
tasks_from: client-install.yml
26+
when: "appliances_mode != 'configure'"
2627
- name: Enrol FreeIPA client
2728
import_role:
2829
name: freeipa

ansible/monitoring.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@
2020
tasks:
2121
- include_role:
2222
name: slurm_stats
23+
tasks_from: "{{ 'configure.yml' if appliances_mode == 'configure' else 'main.yml' }}"
2324

2425
- name: Deploy filebeat
2526
hosts: filebeat
2627
tags: filebeat
2728
tasks:
28-
- import_role:
29+
- include_role:
2930
name: filebeat
31+
tasks_from: "{{ 'runtime.yml' if appliances_mode == 'configure' else 'main.yml' }}"
3032

3133
- name: Deploy node_exporter
3234
hosts: node_exporter
3335
tags: node_exporter
3436
tasks:
35-
- import_role: name=cloudalchemy.node_exporter
37+
- import_role:
38+
name: cloudalchemy.node_exporter
3639

3740
- name: Deploy OpenOndemand exporter
3841
hosts: openondemand
@@ -46,12 +49,13 @@
4649
tasks_from: exporter.yml
4750

4851
- name: Deploy Slurm exporter
49-
hosts: control
52+
hosts: slurm_exporter
5053
become: true
5154
tags: slurm_exporter
5255
tasks:
53-
- import_role:
56+
- include_role:
5457
name: slurm_exporter
58+
tasks_from: "{{ 'configure.yml' if appliances_mode == 'configure' else 'main.yml' }}"
5559

5660
- name: Setup core monitoring software
5761
hosts: prometheus
@@ -68,24 +72,36 @@
6872
# i.e. if prometheus_version isn't defined we don't care, so use what's already there
6973
set_fact:
7074
prometheus_skip_install: "{{ false if prometheus_version is defined else true }}"
71-
when: "{{ (prometheus_binaries.results | map(attribute='stat') | map(attribute='exists')) + [prometheus_skip_install is not defined] }}"
75+
when: "(prometheus_binaries.results | map(attribute='stat') | map(attribute='exists')) + [prometheus_skip_install is not defined]"
7276
- import_role:
7377
name: cloudalchemy.prometheus
7478

7579
- name: Deploy grafana
7680
hosts: grafana
7781
tags: grafana
7882
tasks:
79-
- assert:
80-
that: vault_grafana_admin_password is defined
81-
fail_msg: "Must define vault_grafana_admin_password - use `ansible-playbook generate-passwords.yml` to generate a set of passwords"
83+
- name: Skip plugin installation in configure mode
84+
# done during fatimage - can't do this in vars block as that is recursive
85+
ansible.builtin.set_fact:
86+
grafana_plugins: "{{ [] if appliances_mode == 'configure' else grafana_plugins }}"
87+
- name: Copy Grafana plugins installed in image into persistent grafana state
88+
ansible.builtin.copy:
89+
remote_src: true
90+
src: /var/lib/grafana/plugins/ # trailing / means copy contents
91+
dest: "{{ grafana_data_dir }}/plugins/"
92+
# below matches what already exists:
93+
owner: root
94+
group: root
95+
mode: '0755'
96+
become: true
8297
- include_role:
8398
name: cloudalchemy.grafana
8499
vars:
85-
# We use internal roles to register the dashboards as the role does not support all options that we require.
100+
# Internal role used to install dashboards as cloudalchemy role does not support all required options:
86101
grafana_dashboards: []
87-
- import_role: # done in same play so it can use handlers from cloudalchemy.grafana
102+
- include_role: # done in same play so it can use handlers from cloudalchemy.grafana
88103
name: grafana-dashboards
104+
when: "appliances_mode != 'configure'"
89105

90106
- name: Deploy alertmanager
91107
hosts: alertmanager

ansible/portal.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
become: yes
66
gather_facts: yes # TODO
77
tasks:
8+
- name: Skip openondemand apps installation in configure mode
9+
set_fact:
10+
ood_install_apps: {}
11+
when: appliances_mode == 'configure'
812
- import_role:
913
name: openondemand
1014
tasks_from: main.yml
@@ -19,6 +23,7 @@
1923
- import_role:
2024
name: openondemand
2125
tasks_from: vnc_compute.yml
26+
when: appliances_mode != 'configure' # is run during build
2227

2328
- hosts: openondemand_jupyter
2429
tags:
@@ -30,3 +35,4 @@
3035
- import_role:
3136
name: openondemand
3237
tasks_from: jupyter_compute.yml
38+
when: appliances_mode != 'configure' # is run during build
Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: Disable Pulp repos
2+
- name: Remove password and disable Pulp repos
33
ansible.builtin.yum_repository:
44
file: "{{ item.file }}"
55
name: "{{ item.name }}"
@@ -8,11 +8,25 @@
88
enabled: false
99
loop: "{{ dnf_repos_repolist }}"
1010

11-
- name: Disable EPEL repo
11+
- name: Remove password and disable EPEL repo
1212
ansible.builtin.yum_repository:
1313
name: epel
1414
file: epel
1515
description: "{{ dnf_repos_epel_description }}"
1616
baseurl: "{{ dnf_repos_epel_baseurl }}"
1717
gpgcheck: false
1818
enabled: false
19+
20+
- name: Get all repo files
21+
ansible.builtin.find:
22+
paths: /etc/yum.repos.d
23+
patterns: '*.repo'
24+
register: _dnf_repo_files
25+
26+
- name: Disable every repo
27+
ansible.builtin.replace:
28+
path: "{{ item.path }}"
29+
regexp: '^enabled\ ?=\ ?1'
30+
replace: 'enabled=0'
31+
backup: yes
32+
loop: "{{ _dnf_repo_files.files }}"

0 commit comments

Comments
 (0)