retr0h / ansible-logrotate Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Great module, but looks like when you run it in check/diff mode, the task is skipped. Adding check and diff support would be a great feature.
This ansible role makes the task easier to define different logrotate configuration for different applications. The idea to make it run as ansible module is better than the other hottest ansible logrotate galaxy role (https://github.com/nickhammond/ansible-logrotate)
But when I implement the vars file, I got two problems, in fact three. Here is my task file.
$ cat roles/common/tasks/logrotate.yml
- name: Define logrotate config
logrotate: name=syslog path='/var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler'
args:
options:
- compress
- copytruncate
- missingok
- sharedscripts
- weekly
- rotate 12
- postrotate
- ' /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true'
- endscript
tags:
- logrotate
So I have to:
path='/var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler'
can we have something as:
- name: Define logrotate config
logrotate: name=syslog
path:
- /var/log/cron
- /var/log/maillog
- /var/log/messages
- /var/log/secure
- /var/log/spooler
args:
...
exec script
. - ' /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true'
{
is in new line, as below./var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler
{
compress
copytruncate
missingok
sharedscripts
weekly
rotate 12
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
I know it should work, but will be better to update as
/var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler {
...
}
The only change I had to make was to explicitly define the type for 'options':
options = dict(type='list',
default=['daily',
'missingok',
...
Recently when downloading this role from galaxy I'm getting an older version. Looks like there might be a problem with the tags. 1.0 and 2.0 are pointing to the same commit. Is this correct?
Using the logrotate module with the version from galaxy creates configuration files with one letter on each line:
# Generated by Ansible.
# Local modifications will be overwritten.
/var/log/*.log {
[
'
d
a
i
l
y
'
,
'
m
i
s
s
i
n
g
o
k
'
,
'
r
o
t
a
t
e
8
'
,
'
c
o
m
p
r
e
s
s
'
,
'
d
e
l
a
y
c
o
m
p
r
e
s
s
'
,
'
c
o
p
y
t
r
u
n
c
a
t
e
'
,
'
n
o
t
i
f
e
m
p
t
y
'
]
}
Hi,
The readme says: In process of moving this to into core ansible.
So this is going to be a built in ansible module? Any idea when it will be integrated?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.