1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add playbook and template to set up ansible-pull

Playbook will install ansible, create directory where git checkout goes,
and set up a cron job to run ansible-pull.
This commit is contained in:
Stephen Fromm 2012-04-30 14:24:58 -07:00
parent df61a65344
commit 3803b27f6c
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,19 @@
---
- hosts: all
user: root
vars:
# schdule is fed directly to cron
schedule: '*/15 * * * *'
# User to run ansible-pull as from cron
cron_user: root
# Directory to where repository will be cloned
workdir: /var/lib/ansible/local
# Repository to check out
repo_url: git://github.com/sfromm/ansible-playbooks.git
tasks:
- name: Install ansible
action: yum pkg=ansible state=installed
- name: Create local directory to work from
action: file path=$workdir state=directory owner=root group=root mode=0751
- 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

View file

@ -0,0 +1,2 @@
# Cron job to git clone/pull a repo and then run locally
{{ schedule }} {{ cron_user }} ansible-pull -d {{ workdir }} -U {{ repo_url }}