From 1300590874a979da39033d5f77f3556b430b1d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=BClsdunk?= Date: Thu, 20 Jul 2023 12:02:44 +0200 Subject: [PATCH] Create a munge key if it does not exist --- tasks/munge.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tasks/munge.yml b/tasks/munge.yml index e76cd84..23ec85f 100644 --- a/tasks/munge.yml +++ b/tasks/munge.yml @@ -8,6 +8,31 @@ mode: 0700 state: directory +- name: Check if munge key exists + delegate_to: localhost + become: false + stat: + path: "{{ slurm_munge_key }}" + register: + mungekey + run_once: true + when: slurm_munge_key is defined + +- name: Create munge key + command: sudo -u munge mungekey + args: + creates: "{{ slurm_munge_key }}" + run_once: true + when: slurm_munge_key is defined and not mungekey.stat.exists + +- name: Fetch munge key + fetch: + src: /etc/munge/munge.key + dest: "{{ slurm_munge_key }}" + flat: yes + run_once: true + when: slurm_munge_key is defined and not mungekey.stat.exists + - name: Install munge key ansible.builtin.copy: src: "{{ slurm_munge_key }}"