diff --git a/ansible/.gitignore b/ansible/.gitignore index 2ceeb596b..be3de34c2 100644 --- a/ansible/.gitignore +++ b/ansible/.gitignore @@ -58,4 +58,5 @@ roles/* !roles/squid/** !roles/tuned/ !roles/tuned/** - +!roles/logrotate/ +!roles/logrotate/** diff --git a/ansible/roles/logrotate/README.md b/ansible/roles/logrotate/README.md new file mode 100755 index 000000000..225dd44b9 --- /dev/null +++ b/ansible/roles/logrotate/README.md @@ -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). diff --git a/ansible/roles/logrotate/tasks/configure.yml b/ansible/roles/logrotate/tasks/configure.yml new file mode 100755 index 000000000..376e9f4da --- /dev/null +++ b/ansible/roles/logrotate/tasks/configure.yml @@ -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" \ No newline at end of file diff --git a/ansible/roles/logrotate/tasks/main.yml b/ansible/roles/logrotate/tasks/main.yml new file mode 100755 index 000000000..372b44e49 --- /dev/null +++ b/ansible/roles/logrotate/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- import_tasks: configure.yml \ No newline at end of file diff --git a/ansible/roles/logrotate/templates/slurmctld-logrotate.conf.j2 b/ansible/roles/logrotate/templates/slurmctld-logrotate.conf.j2 new file mode 100755 index 000000000..c19a286f1 --- /dev/null +++ b/ansible/roles/logrotate/templates/slurmctld-logrotate.conf.j2 @@ -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 +} diff --git a/ansible/roles/logrotate/templates/slurmd-logrotate.conf.j2 b/ansible/roles/logrotate/templates/slurmd-logrotate.conf.j2 new file mode 100755 index 000000000..a5dba102b --- /dev/null +++ b/ansible/roles/logrotate/templates/slurmd-logrotate.conf.j2 @@ -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 +} \ No newline at end of file diff --git a/ansible/roles/logrotate/templates/slurmdbd-logrotate.conf.j2 b/ansible/roles/logrotate/templates/slurmdbd-logrotate.conf.j2 new file mode 100755 index 000000000..405b124e3 --- /dev/null +++ b/ansible/roles/logrotate/templates/slurmdbd-logrotate.conf.j2 @@ -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 +} \ No newline at end of file diff --git a/ansible/slurm.yml b/ansible/slurm.yml index 0b7397242..af32e9276 100644 --- a/ansible/slurm.yml +++ b/ansible/slurm.yml @@ -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 \ No newline at end of file