restart on munge key change + buster support

This commit is contained in:
Colin Vandenhof 2021-06-18 02:26:00 -03:00
parent a3104b029f
commit 559ce7e054
7 changed files with 122 additions and 12 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*.swp *.swp
.idea

View File

@ -1,16 +1,19 @@
--- ---
- name: reload slurmd - name: systemd reload
service: systemd:
name: "{{ slurmd_service_name }}" daemon_reload: yes
state: reloaded
when: "'slurmexechosts' in group_names or 'exec' in slurm_roles"
- name: restart slurmd - name: restart munge
service: service:
name: "{{ slurmd_service_name }}" name: munge
state: restarted state: restarted
when: "'slurmexechosts' in group_names or 'exec' in slurm_roles"
- name: reload slurmdbd
service:
name: "{{ slurmdbd_service_name }}"
state: reloaded
when: "'slurmdbdservers' in group_names or 'dbd' in slurm_roles"
- name: reload slurmctld - name: reload slurmctld
service: service:
@ -24,8 +27,20 @@
state: restarted state: restarted
when: "'slurmservers' in group_names or 'controller' in slurm_roles" when: "'slurmservers' in group_names or 'controller' in slurm_roles"
- name: reload slurmdbd - name: reload slurmd
service: service:
name: "{{ slurmdbd_service_name }}" name: "{{ slurmd_service_name }}"
state: reloaded state: reloaded
when: "'slurmdbdservers' in group_names or 'dbd' in slurm_roles" when: "'slurmexechosts' in group_names or 'exec' in slurm_roles"
- name: restart slurmd
service:
name: "{{ slurmd_service_name }}"
state: restarted
when: "'slurmexechosts' in group_names or 'exec' in slurm_roles"

View File

@ -45,6 +45,7 @@ galaxy_info:
versions: versions:
- jessie - jessie
- stretch - stretch
- buster
- name: Ubuntu - name: Ubuntu
versions: versions:
- xenial - xenial

View File

@ -16,6 +16,7 @@
group: munge group: munge
mode: 0400 mode: 0400
when: slurm_munge_key is defined when: slurm_munge_key is defined
notify: restart munge
- name: Ensure Munge is enabled and running - name: Ensure Munge is enabled and running
service: service:

View File

@ -24,3 +24,33 @@
mode: 0755 mode: 0755
state: directory state: directory
when: slurm_create_dirs and __slurm_config_merged.SlurmctldLogFile != omit when: slurm_create_dirs and __slurm_config_merged.SlurmctldLogFile != omit
- name: 'Service slurmctld : Directory of Pidfile must exist and set slurm group permission'
lineinfile:
path: /lib/systemd/system/slurmctld.service
regexp: '{{ item.regexp }}'
line: "{{ item.line }}"
insertafter: '\[Service\]'
loop:
- line : 'RuntimeDirectory={{ __slurm_config_merged.SlurmctldPidFile.split("/")[-2] }}'
regexp : '^RuntimeDirectory'
- line : "Group={{ __slurm_group_name }}"
regexp : '^Group'
- line : 'RuntimeDirectoryMode=0770'
regexp : '^RuntimeDirectoryMode'
notify:
- systemd reload
- reload slurmdbd
when: ansible_distribution == 'Debian'
- name: Service slurmctld , option PIDFile
lineinfile:
path: /lib/systemd/system/slurmctld.service
regexp: 'PIDFile'
line: "PIDFile={{ __slurm_config_merged.SlurmctldPidFile }}"
insertafter: '\[Service\]'
when: __slurm_config_merged.SlurmctldPidFile is defined
notify:
- systemd reload
- reload slurmdbd

View File

@ -38,3 +38,33 @@
- name: cgroup.conf - name: cgroup.conf
config: slurm_cgroup_config config: slurm_cgroup_config
when: item.config in vars when: item.config in vars
- name: 'Service slurmd : Directory of Pidfile must exist and set slurm group permission'
lineinfile:
path: /lib/systemd/system/slurmd.service
regexp: '{{ item.regexp }}'
line: "{{ item.line }}"
insertafter: '\[Service\]'
loop:
- line: 'RuntimeDirectory={{ __slurm_config_merged.SlurmdPidFile.split("/")[-2] }}'
regexp: '^RuntimeDirectory'
- line: "Group={{ __slurm_group_name }}"
regexp: '^Group'
- line: 'RuntimeDirectoryMode=0770'
regexp: '^RuntimeDirectoryMode'
notify:
- systemd reload
- reload slurmdbd
when: ansible_distribution == 'Debian'
- name: Service slurmctld , option PIDFile
lineinfile:
path: /lib/systemd/system/slurmd.service
regexp: 'PIDFile'
line: "PIDFile={{ __slurm_config_merged.SlurmdPidFile }}"
insertafter: '\[Service\]'
when: __slurm_config_merged.SlurmdPidFile is defined
notify:
- systemd reload
- reload slurmdbd

View File

@ -8,10 +8,13 @@
- name: Install slurmdbd.conf - name: Install slurmdbd.conf
template: template:
src: generic.conf.j2 src: generic.conf.j2
dest: "{{ slurm_config_dir }}/slurmdbd.conf" dest: "{{ slurm_config_dir }}/{{ item.name }}"
owner: "{{ __slurm_user_name }}" owner: "{{ __slurm_user_name }}"
group: root group: root
mode: 0400 mode: 0400
with_items:
- name: slurmdbd.conf
config: __slurmdbd_config_merged
notify: notify:
- reload slurmdbd - reload slurmdbd
@ -23,3 +26,32 @@
mode: 0755 mode: 0755
state: directory state: directory
when: slurm_create_dirs and __slurmdbd_config_merged.LogFile when: slurm_create_dirs and __slurmdbd_config_merged.LogFile
- name: 'Service slurmdbd : Directory of Pidfile must exist and set slurm group permission'
lineinfile:
path: /lib/systemd/system/slurmdbd.service
regexp: '{{ item.regexp }}'
line: "{{ item.line }}"
insertafter: '\[Service\]'
loop:
- line : 'RuntimeDirectory={{ __slurmdbd_config_merged.PidFile.split("/")[-2] }}'
regexp : '^RuntimeDirectory'
- line : "Group={{ __slurm_group_name }}"
regexp : '^Group'
- line : 'RuntimeDirectoryMode=0770'
regexp : '^RuntimeDirectoryMode'
notify:
- systemd reload
- reload slurmdbd
when: ansible_distribution == 'Debian'
- name: Service slurmdbd , option PIDFile
lineinfile:
path: /lib/systemd/system/slurmdbd.service
regexp: 'PIDFile'
line: "PIDFile={{ __slurmdbd_config_merged.PidFile }}"
insertafter: '\[Service\]'
when: __slurmdbd_config_merged.PidFile is defined
notify:
- systemd reload
- reload slurmdbd