diff --git a/CICD/plays/allnodes.yml b/CICD/plays/allnodes.yml index 58fc01d131287bc34a90b9f91e078d9f79fdb27c..ad927c62569c56b96b6ee862a3b54fb10eb9b30a 100644 --- a/CICD/plays/allnodes.yml +++ b/CICD/plays/allnodes.yml @@ -29,6 +29,7 @@ - { role: set_password } - { role: ntp } - { role: set_timezone } + - { role: logrotate, tags: [ logrotate, other ] } - hosts: 'DesktopNodes,ComputeNodes,LoginNodes,ManagementNodes' diff --git a/roles/logrotate/files/syslog_CentOS_7 b/roles/logrotate/files/syslog_CentOS_7 new file mode 100644 index 0000000000000000000000000000000000000000..ee373c3a3f3d2cc4dcdf023ade9db54a5d93b971 --- /dev/null +++ b/roles/logrotate/files/syslog_CentOS_7 @@ -0,0 +1,13 @@ +/var/log/cron +/var/log/maillog +/var/log/messages +/var/log/secure +/var/log/spooler +{ + missingok + sharedscripts + compress + postrotate + /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true + endscript +} diff --git a/roles/logrotate/tasks/main.yml b/roles/logrotate/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..b01320963faec46cfc24df222fe0f6a84483eb1d --- /dev/null +++ b/roles/logrotate/tasks/main.yml @@ -0,0 +1,14 @@ +--- +- name: enable compression etc logrotate.conf + replace: + path: /etc/logrotate.conf + regexp: '#compress' + replace: 'compress' + become: true + +- name: /etc/logrotate.d/syslog + copy: + src: "syslog_{{ ansible_distribution }}_{{ ansible_distribution_major_version }}" + dest: /etc/logrotate.d/syslog + become: true + when: ansible_os_family == 'RedHat' \ No newline at end of file