Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add logrotate config #1049

Merged
merged 1 commit into from
Sep 14, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions examples/playbooks/ansible_pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions examples/playbooks/templates/etc_logrotate.d_ansible-pull.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{ logfile }} {
rotate 7
daily
compress
missingok
notifempty
}