Merge pull request #1049 from copperlight/ansible-pull_example_logrotate
add logrotate config
This commit is contained in:
commit
4cffdbbc56
3 changed files with 15 additions and 3 deletions
|
@ -20,12 +20,15 @@
|
|||
|
||||
vars:
|
||||
|
||||
# schdule is fed directly to cron
|
||||
# schedule is fed directly to cron
|
||||
schedule: '*/15 * * * *'
|
||||
|
||||
# User to run ansible-pull as from cron
|
||||
cron_user: root
|
||||
|
||||
# File that ansible will use for logs
|
||||
logfile: /var/log/ansible-pull.log
|
||||
|
||||
# Directory to where repository will be cloned
|
||||
workdir: /var/lib/ansible/local
|
||||
|
||||
|
@ -47,5 +50,7 @@
|
|||
owner=root group=root mode=0644
|
||||
|
||||
- name: Create crontab entry to clone/pull git repository
|
||||
action: template src=templates/ansible-pull.j2 dest=/etc/cron.d/ansible-pull owner=root group=root mode=0644
|
||||
action: template src=templates/etc_cron.d_ansible-pull.j2 dest=/etc/cron.d/ansible-pull owner=root group=root mode=0644
|
||||
|
||||
- name: Create logrotate entry for ansible-pull.log
|
||||
action: template src=templates/etc_logrotate.d_ansible-pull.j2 dest=/etc/logrorate.d/ansible-pull owner=root group=root mode=0644
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# Cron job to git clone/pull a repo and then run locally
|
||||
{{ schedule }} {{ cron_user }} ansible-pull -d {{ workdir }} -U {{ repo_url }} >/var/log/ansible-pull.log 2>&1
|
||||
{{ schedule }} {{ cron_user }} ansible-pull -d {{ workdir }} -U {{ repo_url }} >>{{ logfile }} 2>&1
|
|
@ -0,0 +1,7 @@
|
|||
{{ logfile }} {
|
||||
rotate 7
|
||||
daily
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
}
|
Loading…
Reference in a new issue