From 1de5867980f6c7f98d88b8af339f98242a813664 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Tue, 17 Apr 2018 19:28:48 -0400 Subject: [PATCH] Create slurm log directory and rotate logs --- files/logrotate-slurm | 23 +++++++++++++++++++++++ tasks/main.yml | 8 +++++++- tasks/slurmd.yml | 8 ++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 files/logrotate-slurm diff --git a/files/logrotate-slurm b/files/logrotate-slurm new file mode 100644 index 0000000..94a239d --- /dev/null +++ b/files/logrotate-slurm @@ -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 +} diff --git a/tasks/main.yml b/tasks/main.yml index 0ffbb35..de53ad0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -53,12 +53,18 @@ when: ansible_os_family == "RedHat" # 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: path: /etc/slurm state: directory 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 - name: Acquire hostlist command: scontrol show hostlist {{ groups[item.inventory_group] | join(",") }} diff --git a/tasks/slurmd.yml b/tasks/slurmd.yml index d2a28ae..a3440ce 100644 --- a/tasks/slurmd.yml +++ b/tasks/slurmd.yml @@ -27,3 +27,11 @@ state: directory notify: - reload slurmd + +- name: Create slurm log directory + file: + path: "/var/log/{{ slurm_log_dir_name }}" + owner: slurm + group: slurm + mode: 0755 + state: directory