Skip to content

Commit

Permalink
feat: configure logrotate automated tests (#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogercoll authored Feb 10, 2022
1 parent f720133 commit c358df1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 32 deletions.
10 changes: 10 additions & 0 deletions test/automated/ansible/install-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@
- name: Install GPG
include_role:
name: install-gpg


- hosts: testing_hosts
become: true
gather_facts: yes

tasks:
- name: Configure logrotate
include_role:
name: logrotate
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
---

- name: Configure logrotate for syslog
- name: Create rsyslog script directory
file: path=/usr/lib/rsyslog state=directory mode=0755

- name: Copy rsyslog-rotate script
template:
src: rsyslog.j2
dest: "/etc/logrotate.d/rsyslog"
when: ansible_distribution_major_version != 9
src: rsyslog-rotate
dest: "/usr/lib/rsyslog/rsyslog-rotate"
when: ansible_distribution_major_version == "9" or ansible_distribution_major_version == "8"

- name: Configure logrotate for syslog
template:
src: rsyslog-debian-9.j2
src: rsyslog.j2
dest: "/etc/logrotate.d/rsyslog"
when: ansible_distribution_major_version == 9

...
2 changes: 1 addition & 1 deletion test/automated/ansible/roles/logrotate/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
- "/etc/logrotate.d/rsyslog"
when: ansible_distribution != "SLES"
register: ret
failed_when: ret.stderr != ''
failed_when: ret.stderr != '' and "already exists" not in ret.stderr

...

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if [ -d /run/systemd/system ]; then
systemctl kill -s HUP rsyslog.service
else
invoke-rc.d rsyslog rotate > /dev/null
fi

0 comments on commit c358df1

Please sign in to comment.