diff --git a/deploy/roles/slurm/defaults/main.yml b/deploy/roles/slurm/defaults/main.yml new file mode 100644 index 0000000..a7511c5 --- /dev/null +++ b/deploy/roles/slurm/defaults/main.yml @@ -0,0 +1,4 @@ +--- +ansible_become_method: su +ansible_become_user: spack +ansible_become_flags: --login diff --git a/deploy/roles/slurm/meta/main.yml b/deploy/roles/slurm/meta/main.yml new file mode 100644 index 0000000..51c29c9 --- /dev/null +++ b/deploy/roles/slurm/meta/main.yml @@ -0,0 +1,3 @@ +--- +- dependencies: + - spack diff --git a/deploy/roles/slurm/tasks/main.yml b/deploy/roles/slurm/tasks/main.yml index 3ffbd89..b3d50c3 100644 --- a/deploy/roles/slurm/tasks/main.yml +++ b/deploy/roles/slurm/tasks/main.yml @@ -1,7 +1,35 @@ --- -# https://github.com/dun/munge/issues/31 -- name: Copy munge service file - file: - dest: /lib/systemd/system/munge.service - src: munge.service - notify: restart systemctl +- name: gather info + block: + - shell: "spack find -p munge arch={{ spack_arch }}" + register: munge_location_shell + + - shell: "spack find -p slurm arch={{ spack_arch }}" + register: slurm_location_shell + + - set_facts: + munge_location: "{{ munge_location_shell.stdout }}/lib/munge/systemd" + slurm_location: "{{ slurm_location_shell.stdout }}/etc" + become: yes + tags: slurm + +- name: install slurm on compute nodes + systemd: + name: "{{ item }}" + enabled: yes + with_items: + - "{{ munge_location }}/munge.service" + - "{{ slurm_location }}/slurmd.service" + when: "'compute' in group_names" + tags: slurm + + +- name: install slurm on frontal + systemd: + name: "{{ item }}" + enabled: yes + with_items: + - "{{ slurm_location }}/slurmctld.service" + - "{{ slurm_location }}/slurmdbd.service" + when: "'frontal' in group_names" + tags: slurm