Create slurm log directory and rotate logs

This commit is contained in:
Nate Coraor 2018-04-17 19:28:48 -04:00
parent 388f666081
commit 1de5867980
3 changed files with 38 additions and 1 deletions

23
files/logrotate-slurm Normal file
View File

@ -0,0 +1,23 @@
##
# Slurm Logrotate Configuration
##
/var/log/slurm/*.log {
compress
missingok
nocopytruncate
nocreate
nodelaycompress
nomail
notifempty
noolddir
rotate 5
sharedscripts
size=32M
create 640 slurm root
postrotate
for daemon in $(/usr/bin/scontrol show daemons)
do
killall -SIGUSR2 $daemon
done
endscript
}

View File

@ -53,12 +53,18 @@
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
# As of 17.11, this is only created if you install the example configs package # As of 17.11, this is only created if you install the example configs package
- name: Create /etc/slurm (yum) - name: Create /etc/slurm
file: file:
path: /etc/slurm path: /etc/slurm
state: directory state: directory
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: Install log rotation configuration
copy:
src: logrotate-slurm
dest: /etc/logrotate.d/slurm
when: ansible_os_family == "RedHat"
# FIXME: this task will fail if slurmservers[0] has not already completed the slurm.conf task that follows it # FIXME: this task will fail if slurmservers[0] has not already completed the slurm.conf task that follows it
- name: Acquire hostlist - name: Acquire hostlist
command: scontrol show hostlist {{ groups[item.inventory_group] | join(",") }} command: scontrol show hostlist {{ groups[item.inventory_group] | join(",") }}

View File

@ -27,3 +27,11 @@
state: directory state: directory
notify: notify:
- reload slurmd - reload slurmd
- name: Create slurm log directory
file:
path: "/var/log/{{ slurm_log_dir_name }}"
owner: slurm
group: slurm
mode: 0755
state: directory