Skip to content

Commit af97440

Browse files
committed
Merge branch 'ci/test-compute-init' of github.com:stackhpc/ansible-slurm-appliance into ci/test-compute-init
2 parents 1355b5f + 0ac9de5 commit af97440

File tree

28 files changed

+259
-34
lines changed

28 files changed

+259
-34
lines changed

ansible/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ roles/*
3232
!roles/mysql/**
3333
!roles/systemd/
3434
!roles/systemd/**
35+
!roles/cacerts/
36+
!roles/cacerts/**
3537
!roles/cuda/
3638
!roles/cuda/**
3739
!roles/freeipa/

ansible/bootstrap.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@
130130
- appliances_mode == 'configure'
131131
- not (dnf_repos_allow_insecure_creds | default(false)) # useful for development
132132

133+
- hosts: cacerts:!builder
134+
tags: cacerts
135+
gather_facts: false
136+
tasks:
137+
- name: Install custom cacerts
138+
import_role:
139+
name: cacerts
140+
133141
- hosts: squid
134142
tags: squid
135143
gather_facts: yes
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#cacerts_dest_dir: /etc/pki/ca-trust/source/anchors/
2+
cacerts_cert_dir: "{{ appliances_environment_root }}/cacerts"
3+
cacerts_update: true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
3+
- name: Copy all certificates
4+
copy:
5+
src: "{{ item }}"
6+
dest: /etc/pki/ca-trust/source/anchors/
7+
owner: root
8+
group: root
9+
mode: 0644
10+
with_fileglob:
11+
- "{{ cacerts_cert_dir }}/*"
12+
become: true
13+
14+
- name: Update trust store
15+
command: update-ca-trust extract
16+
become: true
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- name: Copy cacerts from deploy host to /exports/cluster/cacerts/
2+
copy:
3+
src: "{{ item }}"
4+
dest: /exports/cluster/cacerts/
5+
owner: root
6+
group: root
7+
mode: 0644
8+
with_fileglob:
9+
- "{{ cacerts_cert_dir }}/*"
10+
delegate_to: "{{ groups['control'] | first }}"
11+
run_once: true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- import_tasks: configure.yml

ansible/roles/compute_init/README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ it also requires an image build with the role name added to the
4646
| bootstrap.yml | (system users) | None required - use image build | No |
4747
| bootstrap.yml | systemd | None required - use image build | No |
4848
| bootstrap.yml | selinux | None required - use image build | Maybe [1] |
49-
| bootstrap.yml | sshd | None at present | No |
49+
| bootstrap.yml | sshd | Fully supported | No |
5050
| bootstrap.yml | dnf_repos | None at present [2] | - |
51+
| bootstrap.yml | cacerts | Supported [3] | - |
5152
| bootstrap.yml | squid | Not relevant for compute nodes | n/a |
5253
| bootstrap.yml | tuned | Fully supported | No |
5354
| bootstrap.yml | freeipa_server | Not relevant for compute nodes | n/a |
@@ -61,25 +62,25 @@ it also requires an image build with the role name added to the
6162
| bootstrap.yml | ansible_init (install) | Not relevant during boot | n/a |
6263
| bootstrap.yml | k3s (install) | Not relevant during boot | n/a |
6364
| hooks/post-bootstrap.yml | ? | None at present | n/a |
64-
| iam.yml | freeipa_client | None at present [3] | Yes |
65+
| iam.yml | freeipa_client | None at present [4] | Yes |
6566
| iam.yml | freeipa_server | Not relevant for compute nodes | n/a |
66-
| iam.yml | sssd | None at present | No |
67+
| iam.yml | sssd | Fully supported | No |
6768
| filesystems.yml | block_devices | None required - role deprecated | n/a |
6869
| filesystems.yml | nfs | All client functionality | No |
69-
| filesystems.yml | manila | All functionality | No [4] |
70+
| filesystems.yml | manila | All functionality | No [5] |
7071
| filesystems.yml | lustre | None at present | Yes |
71-
| extras.yml | basic_users | All functionality [5] | No |
72-
| extras.yml | eessi | All functionality [6] | No |
73-
| extras.yml | cuda | None required - use image build | Yes [7] |
72+
| extras.yml | basic_users | All functionality [6] | No |
73+
| extras.yml | eessi | All functionality [7] | No |
74+
| extras.yml | cuda | None required - use image build | Yes [8] |
7475
| extras.yml | persist_hostkeys | Not relevant for compute nodes | n/a |
7576
| extras.yml | compute_init (export) | Not relevant for compute nodes | n/a |
7677
| extras.yml | k9s (install) | Not relevant during boot | n/a |
77-
| extras.yml | extra_packages | None at present [8] | - |
78+
| extras.yml | extra_packages | None at present [9] | - |
7879
| slurm.yml | mysql | Not relevant for compute nodes | n/a |
7980
| slurm.yml | rebuild | Not relevant for compute nodes | n/a |
80-
| slurm.yml | openhpc [9] | All slurmd functionality | No |
81-
| slurm.yml | (set memory limits) | None at present | - |
82-
| slurm.yml | (block ssh) | None at present | - |
81+
| slurm.yml | openhpc [10] | All slurmd functionality | No |
82+
| slurm.yml | (set memory limits) | Fully supported | No |
83+
| slurm.yml | (block ssh) | Fully supported | No |
8384
| portal.yml | (openondemand server) | Not relevant for compute nodes | n/a |
8485
| portal.yml | (openondemand vnc desktop) | None required - use image build | No |
8586
| portal.yml | (openondemand jupyter server) | None required - use image build | No |
@@ -92,16 +93,17 @@ it also requires an image build with the role name added to the
9293
Notes:
9394
1. `selinux` is set to disabled in StackHPC images.
9495
2. Requirement for this functionality is TBD.
95-
3. FreeIPA client functionality would be better provided using a client fork
96+
3. `cacerts_cert_dir` must be the same on all nodes.
97+
4. FreeIPA client functionality would be better provided using a client fork
9698
which uses pkinit keys rather than OTP to reenrol nodes.
97-
4. Assuming default Ceph client version.
98-
5. Assumes home directory already exists on shared storage.
99-
6. Assumes `cvmfs_config` is the same on control node and all compute nodes.
100-
7. If `cuda` role was run during build, the nvidia-persistenced is enabled
99+
5. Assuming default Ceph client version.
100+
6. Assumes home directory already exists on shared storage.
101+
7. Assumes `cvmfs_config` is the same on control node and all compute nodes.
102+
8. If `cuda` role was run during build, the nvidia-persistenced is enabled
101103
and will start during boot.
102-
8. Would require `dnf_repos`.
103-
9. `openhpc` does not need to be added to `compute_init_enable`, this is
104-
automatically enabled by adding `compute`.
104+
9. Would require `dnf_repos`.
105+
10. `openhpc` does not need to be added to `compute_init_enable`, this is
106+
automatically enabled by adding `compute`.
105107

106108
## Approach
107109
This works as follows:

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
enable_compute: "{{ os_metadata.meta.compute | default(false) | bool }}"
1010
enable_resolv_conf: "{{ os_metadata.meta.resolv_conf | default(false) | bool }}"
1111
enable_etc_hosts: "{{ os_metadata.meta.etc_hosts | default(false) | bool }}"
12+
enable_cacerts: "{{ os_metadata.meta.cacerts | default(false) | bool }}"
13+
enable_sssd: "{{ os_metadata.meta.sssd | default(false) | bool }}"
14+
enable_sshd: "{{ os_metadata.meta.sshd | default(false) | bool }}"
1215
enable_tuned: "{{ os_metadata.meta.tuned | default(false) | bool }}"
1316
enable_nfs: "{{ os_metadata.meta.nfs | default(false) | bool }}"
1417
enable_manila: "{{ os_metadata.meta.manila | default(false) | bool }}"
@@ -132,10 +135,32 @@
132135
mode: 0644
133136
when: enable_etc_hosts
134137

138+
- name: Configure cacerts
139+
ansible.builtin.include_role:
140+
name: cacerts
141+
vars:
142+
cacerts_cert_dir: "/mnt/cluster/cacerts"
143+
when: enable_cacerts
144+
145+
- name: Configure sshd
146+
ansible.builtin.include_role:
147+
name: sshd
148+
vars:
149+
sshd_conf_src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sshd.conf"
150+
when: enable_sshd
151+
135152
- name: Configure tuned
136153
include_tasks: tasks/tuned.yml
137154
when: enable_tuned
138155

156+
- name: Configure sssd
157+
ansible.builtin.include_role:
158+
name: sssd
159+
tasks_from: configure.yml
160+
vars:
161+
sssd_conf_src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sssd.conf"
162+
when: enable_sssd
163+
139164
# NFS client mount
140165
- name: If nfs-clients is present
141166
include_tasks: tasks/nfs-clients.yml

ansible/roles/compute_init/tasks/export.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,30 @@
7171
remote_src: true
7272
run_once: true
7373
delegate_to: "{{ groups['control'] | first }}"
74+
75+
- name: Export cacerts
76+
ansible.builtin.include_role:
77+
name: cacerts
78+
tasks_from: export.yml
79+
when: "'cacerts' in group_names"
80+
81+
- name: Create hostconfig directory
82+
file:
83+
path: "/exports/cluster/hostconfig/{{ inventory_hostname }}/"
84+
state: directory
85+
owner: root
86+
group: root
87+
mode: u=rw,go=
88+
delegate_to: "{{ groups['control'] | first }}"
89+
90+
- name: Template sssd config
91+
import_role:
92+
name: sssd
93+
tasks_from: export.yml
94+
when: "'sssd' in group_names"
95+
96+
- name: Template sshd config
97+
import_role:
98+
name: sshd
99+
tasks_from: export.yml
100+
when: "'sshd' in group_names"

ansible/roles/compute_init/tasks/install.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- library
1414
- filter_plugins
1515
- tasks
16+
- roles
1617

1718
- name: Inject files from roles
1819
copy:
@@ -32,6 +33,12 @@
3233
dest: files/NetworkManager-dns-none.conf
3334
- src: ../../basic_users/filter_plugins/filter_keys.py
3435
dest: filter_plugins/filter_keys.py
36+
- src: ../../cacerts
37+
dest: roles/
38+
- src: ../../sssd
39+
dest: roles/
40+
- src: ../../sshd
41+
dest: roles/
3542
- src: ../../tuned/tasks/configure.yml
3643
dest: tasks/tuned.yml
3744
- src: ../../stackhpc.nfs/tasks/nfs-clients.yml

0 commit comments

Comments
 (0)