Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logrotate #418

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ansible/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ roles/*
!roles/squid/**
!roles/tuned/
!roles/tuned/**

!roles/logrotate/
!roles/logrotate/**
38 changes: 38 additions & 0 deletions ansible/roles/logrotate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Role Name
=========

A brief description of the role goes here.

Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
roles:
- { role: username.rolename, x: 42 }

License
-------

BSD

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
24 changes: 24 additions & 0 deletions ansible/roles/logrotate/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- name: Deploy slurmctld logrotate configuration
template:
src: slurmctld-logrotate.conf.j2
dest: /etc/logrotate.d/slurmctld
when:
- openhpc_enable.control
- "'SlurmctldLogFile' in openhpc_config_extra"

- name: Deploy slurmd logrotate configuration
template:
src: slurmd-logrotate.conf.j2
dest: /etc/logrotate.d/slurmd
when:
- openhpc_enable.batch
- "'SlurmdLogFile' in openhpc_config_extra"

- name: Deploy slurmdbd logrotate configuration
template:
src: slurmdbd-logrotate.conf.j2
dest: /etc/logrotate.d/slurmdbd
when:
- openhpc_enable.database
- "'SlurmdbdLogFile' in openhpc_config_extra"
2 changes: 2 additions & 0 deletions ansible/roles/logrotate/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
- import_tasks: configure.yml
16 changes: 16 additions & 0 deletions ansible/roles/logrotate/templates/slurmctld-logrotate.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{ openhpc_config_extra.SlurmctldLogFile }} {
compress
missingok
nocopytruncate
nodelaycompress
nomail
notifempty
noolddir
rotate 5
sharedscripts
size 5M
create 600 slurm root
postrotate
pkill -x --signal SIGUSR2 slurmctld
endscript
}
17 changes: 17 additions & 0 deletions ansible/roles/logrotate/templates/slurmd-logrotate.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

{{ openhpc_config_extra.SlurmdLogFile }} {
compress
missingok
nocopytruncate
nodelaycompress
nomail
notifempty
noolddir
rotate 5
sharedscripts
size 5M
create 600 slurm root
postrotate
pkill -x --signal SIGUSR2 slurmd
endscript
}
16 changes: 16 additions & 0 deletions ansible/roles/logrotate/templates/slurmdbd-logrotate.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{ openhpc_config_extra.SlurmdbdLogFile }} {
compress
missingok
nocopytruncate
nodelaycompress
nomail
notifempty
noolddir
rotate 5
sharedscripts
size 5M
create 600 slurm root
postrotate
pkill -x --signal SIGUSR2 slurmdbd
endscript
}
9 changes: 9 additions & 0 deletions ansible/slurm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,12 @@
+:adm:ALL
-:ALL:ALL
# vagrant uses (deprecated) ansible_ssh_user

- name: activate log rotation
hosts: openhpc
tags:
- logrotate
- openhpc
tasks:
- import_role:
name: logrotate
Loading