Six things were wrong, one behind the other, and every one of them let the session get further before dying. The per-user server never restarted. "nginx_stage pun -s stop" prints a path and does nothing; the process serving my requests was 42 minutes old, so none of the configuration I was changing had any effect. Every conclusion drawn before finding this was drawn against a stale process. "nginx -u USER -s stop" actually stops it. The cluster config named its own cluster, so every sbatch passed --cluster, which Slurm can only resolve through slurmdbd. There is no accounting database here: "'c001' can't be reached now". The key is for federated Slurm. Removed, and the job queued and ran. TigerVNC is not TurboVNC. OnDemand's template runs "vncserver -log ... -noxstartup" and both are TurboVNC options; EL9's TigerVNC rejects -log outright. The container carries TurboVNC from the project's own release now, pinned. TurboVNC's vncserver is a Perl script and the container had no perl. It installed cleanly, sat on PATH, and died with "env: 'perl': No such file or directory". The build now runs perl -c against it. --bind /opt mounted the host's /opt over the container's own and hid /opt/TurboVNC, so vncserver was "command not found" inside an image that demonstrably contained it. Only /opt/apps is bound. --cleanenv also drops the image's PATH, so the wrapper states it. websockify_cmd defaults to /opt/websockify/run. With everything else fixed the session came all the way up - Xvnc running, XFCE started, connection details written - and stopped at "[websockify]: failed to launch!". And ood_portal.yml had no node_uri or rnode_uri, so Apache never created the proxy locations: the browser got 404 on the websocket for a session that was healthy from every other angle. Verified end to end: connection.yml written with host c001-node1 display 1 websocket 15927, the sessions page offering noVNC, and a real WebSocket handshake through the public name answering 101 Switching Protocols - browser to control plane to Apache to websockify to Xvnc. Two smaller things on the way. A YAML anchor shared between the basic and vnc wrappers parsed fine and stopped the dashboard from starting at all, so they are written out. And the cluster user now gets an SSH key of its own at first boot rather than at image build - baked into the template it would be one key shared by every cluster - which is what the portal's terminal needs, and what MPI needs to start ranks over SSH. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
175 lines
5.7 KiB
YAML
175 lines
5.7 KiB
YAML
---
|
|
# Base preparation of a tenant head node. Ported from scripts/10-head-base.sh.
|
|
|
|
- name: Set the hostname
|
|
ansible.builtin.hostname:
|
|
name: "{{ inventory_hostname }}"
|
|
|
|
- name: Write /etc/hosts
|
|
ansible.builtin.template:
|
|
src: hosts.j2
|
|
dest: /etc/hosts
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
|
|
- name: Enable EPEL and CRB
|
|
block:
|
|
- name: Install epel-release
|
|
ansible.builtin.dnf:
|
|
name: [epel-release, dnf-plugins-core]
|
|
state: present
|
|
- name: Enable the CRB repository
|
|
ansible.builtin.command: dnf config-manager --set-enabled crb
|
|
register: crb
|
|
changed_when: false
|
|
|
|
tags: [install]
|
|
- name: Install base packages
|
|
ansible.builtin.dnf:
|
|
name:
|
|
- vim
|
|
- git
|
|
- wget
|
|
- curl
|
|
- rsync
|
|
- jq
|
|
- tar
|
|
- bash-completion
|
|
- tcpdump
|
|
- bind-utils
|
|
- iproute
|
|
- nmap-ncat
|
|
- firewalld
|
|
- chrony
|
|
state: present
|
|
|
|
tags: [install]
|
|
# A tenant head node runs PXE, NFS and overlay machinery whose SELinux
|
|
# labelling is fiddly to get right. This is a lab posture, not a production
|
|
# one; enforcing is the correct setting once the policy is worked out.
|
|
- name: Set SELinux to permissive
|
|
ansible.posix.selinux:
|
|
policy: targeted
|
|
state: permissive
|
|
|
|
tags: [install]
|
|
- name: Enable chronyd
|
|
ansible.builtin.systemd:
|
|
name: chronyd
|
|
enabled: true
|
|
state: started
|
|
|
|
tags: [install]
|
|
- name: Enable firewalld
|
|
ansible.builtin.systemd:
|
|
name: firewalld
|
|
enabled: true
|
|
state: started
|
|
|
|
tags: [install]
|
|
# The cluster fabric is the tenant's own private segment, so it is trusted.
|
|
# The management NIC is not.
|
|
#
|
|
# The zone has to be written onto the NetworkManager connection, not just into
|
|
# firewalld. NM owns these interfaces and re-asserts its own connection.zone on
|
|
# every activation, silently overriding firewalld's permanent configuration.
|
|
# Setting it only in firewalld leaves the interface in "public", where port
|
|
# 9873 is closed - so nodes PXE boot far enough to ask warewulfd for a kernel
|
|
# and then hang, which looks like a provisioning fault rather than a firewall.
|
|
- name: Find the NetworkManager connection for the cluster interface
|
|
ansible.builtin.command: nmcli -g GENERAL.CONNECTION device show {{ cluster_if }}
|
|
register: common_cluster_conn
|
|
changed_when: false
|
|
|
|
- name: Put the cluster interface in the trusted zone, via NetworkManager
|
|
ansible.builtin.command: >
|
|
nmcli connection modify "{{ common_cluster_conn.stdout | trim }}"
|
|
connection.zone trusted
|
|
changed_when: true
|
|
notify: Reactivate the cluster interface
|
|
|
|
- name: Put the cluster interface in the trusted zone, in firewalld too
|
|
ansible.posix.firewalld:
|
|
zone: trusted
|
|
interface: "{{ cluster_if }}"
|
|
permanent: true
|
|
state: enabled
|
|
notify: Reload firewalld
|
|
|
|
- name: Masquerade the tenant subnet out through management
|
|
ansible.posix.firewalld:
|
|
zone: "{{ item }}"
|
|
masquerade: true
|
|
permanent: true
|
|
state: enabled
|
|
loop: [public, trusted]
|
|
notify: Reload firewalld
|
|
|
|
- name: Enable IPv4 forwarding
|
|
ansible.posix.sysctl:
|
|
name: net.ipv4.ip_forward
|
|
value: "1"
|
|
sysctl_file: /etc/sysctl.d/99-warewulf.conf
|
|
reload: true
|
|
|
|
# The cluster user is created here, not with Slurm, and at template time
|
|
# rather than per tenant.
|
|
#
|
|
# It has to exist before the node image is compiled, because that is when
|
|
# the user is written into the image the compute nodes boot. Creating it
|
|
# later - as it was, in the Slurm role - meant the image was built without
|
|
# it and the account never reached the nodes: jobs ran by uid, `whoami`
|
|
# failed, and anything that resolved a username broke. It is the same user
|
|
# on every tenant, so baking it into the template costs a tenant nothing.
|
|
- name: Create the cluster user
|
|
ansible.builtin.user:
|
|
name: "{{ hpc_user }}"
|
|
shell: /bin/bash
|
|
create_home: true
|
|
tags: [install]
|
|
|
|
# Deliberately not install-tagged, unlike the account above. The account is
|
|
# created while the template is built, so anything created alongside it is
|
|
# baked in and shared by every cluster cloned from it - and an SSH key
|
|
# shared by every cluster is one key that opens all of them. This runs on
|
|
# first boot instead, so each cluster generates its own.
|
|
- name: Give the cluster user a key of its own
|
|
ansible.builtin.user:
|
|
name: "{{ hpc_user }}"
|
|
generate_ssh_key: true
|
|
ssh_key_type: ed25519
|
|
ssh_key_file: .ssh/id_ed25519
|
|
ssh_key_comment: "{{ hpc_user }}@{{ slurm_cluster_name | default('cluster') }}"
|
|
force: false
|
|
|
|
# Without this the account cannot reach its own cluster, and two unrelated
|
|
# looking things both fail: the portal's terminal, which works by opening
|
|
# an SSH session to the login host, and any MPI job that starts its ranks
|
|
# over SSH rather than through Slurm.
|
|
#
|
|
# One key is enough because /home is shared - the same authorized_keys is
|
|
# read on the head and on every compute node.
|
|
- name: Let the cluster user reach its own nodes
|
|
ansible.posix.authorized_key:
|
|
user: "{{ hpc_user }}"
|
|
key: "{{ lookup('file', '/home/' + hpc_user + '/.ssh/id_ed25519.pub') }}"
|
|
# Only from inside the cluster fabric. The home directory is exported
|
|
# to that subnet and nowhere else, but saying so in the file means a
|
|
# copy that escapes is still not a way in.
|
|
key_options: 'from="{{ cluster_cidr }}"'
|
|
state: present
|
|
|
|
# The first connection to each node would otherwise stop at a host key
|
|
# prompt, inside a job with no terminal to answer it.
|
|
- name: Do not prompt for host keys inside the cluster
|
|
ansible.builtin.copy:
|
|
dest: "/home/{{ hpc_user }}/.ssh/config"
|
|
owner: "{{ hpc_user }}"
|
|
group: "{{ hpc_user }}"
|
|
mode: "0600"
|
|
content: |
|
|
# Written by Ansible.
|
|
Host c{{ '%03d' | format(cluster_id | int) }}-* 10.64.*
|
|
StrictHostKeyChecking accept-new
|