Installing and configuring prerequisites

Create the necessary user accounts

Slurm and Munge require consistent UID and GID across all servers and nodes in the cluster, including the slurm and munge users.

---
- name: Ensure group munge exists
  ansible.builtin.group:
    name: munge
    gid: 961
    state: present

- name: Create munge user
  ansible.builtin.user:
    name: munge
    comment: MUNGE Uid 'N' Gid Emporium
    create_home: true
    home: /var/lib/munge
    uid: 961
    group: munge
    shell: /sbin/nologin
    state: present

- name: Ensure group slurm exists
  ansible.builtin.group:
    name: slurm
    gid: 962
    state: present

- name: Create slurm user
  ansible.builtin.user:
    name: slurm
    comment: SLURM workload manager
    create_home: true
    home: /var/lib/slurm
    uid: 962
    group: slurm
    shell: /sbin/nologin
    state: present

Be aware to create the users in both master and compute nodes.

Munge authentication

- name: Install munge
  ansible.builtin.yum:
    name:
      - munge
      - munge-libs
      - rng-tools
    state: latest
    update_cache: true

- name: Copy munge key
  ansible.builtin.copy:
    src: munge.key
    dest: /etc/munge/munge.key
    owner: munge
    group: munge
    mode: "0400"

- name: Start munge service
  ansible.builtin.service:
    name: munge
    state: started
    enabled: true

The Munge key can be generated (IN MASTER ONLY) by running:

dd if=/dev/urandom bs=1 count=1024 > munge.key

The key should be copied to all compute nodes as well.

Installation of Common Packages

Install all the necessary packages in both master and compute nodes. If packages are not available in compute nodes, follow the steps in Exercise 5: RPM repositories with Cobbler to create a new repository called slurm and add it to the cobbler profile accordingly.

- name: Install utilities
  ansible.builtin.yum:
    name:
      - openssl
      - numactl
      - hwloc
      - lua
      - libibmad
      - libibumad
    state: latest
    update_cache: true

- name: Install slurm common packages
  ansible.builtin.yum:
    name:
      - slurm
      - slurm-perlapi
      - slurm-pam_slurm