Skip to content

Commit 771ed73

Browse files
committed
use base-64 encoded munge key
1 parent 81a3370 commit 771ed73

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ each list element:
4242

4343
`openhpc_slurm_configless`: Optional, default false. If true then slurm's ["configless" mode](https://slurm.schedmd.com/configless_slurm.html) is used.
4444

45-
`openhpc_munge_key`: Optional. Define a munge key to use. If not provided then one is generated but the `openhpc_slurm_control_host` must be in the play.
45+
`openhpc_munge_key_b64`: Optional. A base-64 encoded munge key. If not provided then the one generated on package install is used, but the `openhpc_slurm_control_host` must be in the play.
4646

4747
`openhpc_login_only_nodes`: Optional. If using "configless" mode specify the name of an ansible group containing nodes which are login-only nodes (i.e. not also control nodes), if required. These nodes will run `slurmd` to contact the control node for config.
4848

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ ohpc_default_extra_repos:
125125
# Concatenate all repo definitions here
126126
ohpc_repos: "{{ ohpc_openhpc_repos[ansible_distribution_major_version] + ohpc_default_extra_repos[ansible_distribution_major_version] + openhpc_extra_repos }}"
127127

128-
openhpc_munge_key:
128+
openhpc_munge_key_b64:
129129
openhpc_login_only_nodes: ''
130130
openhpc_module_system_install: true
131131

tasks/runtime.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,17 @@
1818
state: directory
1919
when: inventory_hostname == openhpc_slurm_control_host
2020

21-
- name: Generate a Munge key on control host
22-
# NB this is usually a no-op as the package install actually generates a (node-unique) one, so won't usually trigger handler
23-
command: "dd if=/dev/urandom of=/etc/munge/munge.key bs=1 count=1024"
24-
args:
25-
creates: "/etc/munge/munge.key"
26-
when: inventory_hostname == openhpc_slurm_control_host
27-
2821
- name: Retrieve Munge key from control host
22+
# package install generates a node-unique one
2923
slurp:
3024
src: "/etc/munge/munge.key"
3125
register: openhpc_control_munge_key
3226
delegate_to: "{{ openhpc_slurm_control_host }}"
3327
when: openhpc_slurm_control_host in ansible_play_hosts
3428

35-
- name: Fix permissions on /etc to pass Munge startup checks
36-
# Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2 makes /etc g=rwx rather than g=rx (where group=root)
37-
# which fails munged startup checks
38-
file:
39-
path: /etc
40-
state: directory
41-
mode: g-w
42-
4329
- name: Write Munge key
4430
copy:
45-
content: "{{ openhpc_munge_key or (openhpc_control_munge_key.content | b64decode) }}"
31+
content: "{{ (openhpc_munge_key_b64 or openhpc_control_munge_key.content) | b64decode }}"
4632
dest: "/etc/munge/munge.key"
4733
owner: munge
4834
group: munge

tasks/validate.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,16 @@
4040
loop: "{{ _openhpc_gres_autodetect_groups }}"
4141
run_once: true
4242

43-
- name: Fail if configuration is old
43+
- name: Fail if partition configuration is outdated
4444
assert:
4545
that: openhpc_slurm_partitions is not defined
4646
fail_msg: stackhpc.openhpc parameter openhpc_slurm_partitions has been replaced - see openhpc_nodegroups and openhpc_partitions
4747
delegate_to: localhost
4848
run_once: true
49+
50+
- name: Fail if munge key configuration is outdated
51+
assert:
52+
that: openhpc_munge_key is not defined
53+
fail_msg: stackhpc.openhpc parameter openhpc_munge_key has been replaced with openhpc_munge_key_b64
54+
delegate_to: localhost
55+
run_once: true

0 commit comments

Comments
 (0)