A job ran as uid 1001 on a compute node where uid 1001 had no name. `whoami` failed, `id -un` failed, and anything that resolved a username broke. The home directory worked, which is what made it look fine: /home is NFS and the uids matched, so files landed in the right place while the account they belonged to did not exist on the machine writing them. The cause was ordering. wwctl image syncuser writes the head's accounts into the image chroot, and it ran in the Slurm role - after node_image had already compiled the image. The account reached the chroot and never the nodes. In the template build it was worse: golden.yml runs slurm before node_image, so it was syncing users into an image that had not been imported yet. The user is now created in the common role, install-tagged, and syncuser moved into node_image between the import and the build. It touches the chroot, so the staleness gate sees it and compiles - which is the gate working as intended rather than a special case. Both happen at template time, and it is the same account on every tenant, so a tenant pays nothing: provisioning still measured 138s. Copying /etc/passwd into an overlay would have been the faster-looking fix and the wrong one. The image has its own system accounts at its own uids; syncuser merges, and overwriting would have replaced them. Measured on a node in a cold-provisioned tenant: uid=1001 name=hpcuser whoami=hpcuser against `name=id: cannot find name for user ID 1001` before. This is a single-user fix, not multi-user support. Per-person identity in the portal and per-user accounting are deliberately not here.
161 lines
5.0 KiB
YAML
161 lines
5.0 KiB
YAML
---
|
|
# OpenHPC, Slurm and MUNGE on the head node, plus the "hpc" overlay that
|
|
# carries slurm.conf and munge.key to the compute nodes.
|
|
# Ported from scripts/60-slurm-openhpc.sh.
|
|
|
|
- name: Install the OpenHPC release package
|
|
ansible.builtin.dnf:
|
|
name: "{{ openhpc_release_url }}"
|
|
state: present
|
|
disable_gpg_check: true
|
|
|
|
tags: [install]
|
|
- name: Install OpenHPC base, Slurm server and MUNGE
|
|
ansible.builtin.dnf:
|
|
name: [ohpc-base, lmod-ohpc, ohpc-slurm-server, munge]
|
|
state: present
|
|
|
|
tags: [install]
|
|
- name: Install the compiler and MPI into the shared tree
|
|
ansible.builtin.dnf:
|
|
name:
|
|
- "{{ compiler_module }}-compilers-ohpc"
|
|
- "{{ mpi_module }}-{{ compiler_module }}-ohpc"
|
|
state: present
|
|
|
|
tags: [install]
|
|
# lmod-ohpc's /etc/profile.d/lmod.sh ends with "module try-add ohpc", so this
|
|
# file is what gives every login shell the toolchain. OpenHPC ships
|
|
# lmod-defaults-* only for gnu12 and gnu15 combinations; without a matching
|
|
# one, MPI binaries fail at run time with "libucp.so.0: cannot open shared
|
|
# object file" unless the user loads modules by hand. It lives on /opt/ohpc,
|
|
# exported read-only to the nodes, so one copy serves the whole cluster.
|
|
- name: Install the default login modulefile
|
|
ansible.builtin.template:
|
|
src: ohpc-modulefile.j2
|
|
dest: /opt/ohpc/pub/modulefiles/ohpc
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
|
|
tags: [install]
|
|
- name: Create the MUNGE key
|
|
ansible.builtin.command: /usr/sbin/create-munge-key -f
|
|
args:
|
|
creates: /etc/munge/munge.key
|
|
|
|
- name: Fix MUNGE key ownership
|
|
ansible.builtin.file:
|
|
path: /etc/munge/munge.key
|
|
owner: munge
|
|
group: munge
|
|
mode: "0400"
|
|
|
|
- name: Enable MUNGE
|
|
ansible.builtin.systemd:
|
|
name: munge
|
|
enabled: true
|
|
state: started
|
|
|
|
- name: Write slurm.conf
|
|
ansible.builtin.template:
|
|
src: slurm.conf.j2
|
|
dest: /etc/slurm/slurm.conf
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify: Restart slurmctld
|
|
|
|
- name: Write cgroup.conf
|
|
ansible.builtin.copy:
|
|
dest: /etc/slurm/cgroup.conf
|
|
owner: root
|
|
mode: "0644"
|
|
content: |
|
|
CgroupPlugin=cgroup/v2
|
|
ConstrainCores=yes
|
|
ConstrainRAMSpace=yes
|
|
notify: Restart slurmctld
|
|
|
|
- name: Create Slurm spool and log
|
|
ansible.builtin.file:
|
|
path: "{{ item.p }}"
|
|
state: directory
|
|
owner: "{{ item.o }}"
|
|
group: "{{ item.o }}"
|
|
mode: "0755"
|
|
loop:
|
|
- { p: /var/spool/slurm/ctld, o: slurm }
|
|
- { p: /var/spool/slurm/d, o: root }
|
|
|
|
- name: Create the hpc overlay
|
|
ansible.builtin.command: wwctl overlay create hpc
|
|
register: slurm_overlay_create
|
|
failed_when: slurm_overlay_create.rc != 0 and 'exists' not in (slurm_overlay_create.stderr | default(''))
|
|
changed_when: slurm_overlay_create.rc == 0
|
|
|
|
- name: Import the cluster configuration into the hpc overlay
|
|
ansible.builtin.command: wwctl overlay import -p -o hpc {{ item }} {{ item }}
|
|
loop:
|
|
- /etc/munge/munge.key
|
|
- /etc/slurm/slurm.conf
|
|
- /etc/slurm/cgroup.conf
|
|
changed_when: true
|
|
|
|
# The munge account only exists once the package is installed, so the ids are
|
|
# looked up here rather than before the role runs.
|
|
- name: Look up the munge uid
|
|
ansible.builtin.command: id -u munge
|
|
register: slurm_munge_uid
|
|
changed_when: false
|
|
|
|
- name: Look up the munge gid
|
|
ansible.builtin.command: id -g munge
|
|
register: slurm_munge_gid
|
|
changed_when: false
|
|
|
|
# "overlay import -p" creates parent directories as 0500 root:root. Left
|
|
# uncorrected this produces two separate failures: /etc becomes inaccessible
|
|
# to every non-root user on the node, and munged refuses to start with
|
|
# "Failed to check keyfile: Permission denied" because it validates the
|
|
# directory holding its key, not just the key.
|
|
- name: Correct the overlay directory permissions
|
|
ansible.builtin.command: "{{ item }}"
|
|
loop:
|
|
- wwctl overlay chmod hpc /etc 0755
|
|
- wwctl overlay chown hpc /etc/munge {{ slurm_munge_uid.stdout }}:{{ slurm_munge_gid.stdout }}
|
|
- wwctl overlay chmod hpc /etc/munge 0700
|
|
- wwctl overlay chown hpc /etc/munge/munge.key {{ slurm_munge_uid.stdout }}:{{ slurm_munge_gid.stdout }}
|
|
- wwctl overlay chmod hpc /etc/munge/munge.key 0400
|
|
- wwctl overlay chmod hpc /etc/slurm 0755
|
|
changed_when: true
|
|
|
|
- name: Set the profile's system overlays
|
|
ansible.builtin.command: >
|
|
wwctl profile set --yes default
|
|
-O {{ warewulf_system_overlays | join(',') }}
|
|
changed_when: true
|
|
|
|
- name: Make the shared /opt mount automatic on the nodes
|
|
ansible.builtin.replace:
|
|
path: /etc/warewulf/nodes.conf
|
|
regexp: 'defaults,noauto,nofail,ro'
|
|
replace: 'defaults,nofail,ro'
|
|
|
|
# Overlays only. Syncing users into the image belongs with the image, and
|
|
# happens there before it is compiled - doing it here ran after the build
|
|
# and so changed nothing the nodes would ever see.
|
|
- name: Rebuild the overlays
|
|
ansible.builtin.command: wwctl overlay build
|
|
changed_when: true
|
|
|
|
- name: Configure NFS exports
|
|
ansible.builtin.command: wwctl configure nfs
|
|
changed_when: true
|
|
|
|
- name: Enable slurmctld
|
|
ansible.builtin.systemd:
|
|
name: slurmctld
|
|
enabled: true
|
|
state: started
|