system-config/playbooks/roles/ansible-cron/tasks/main.yaml
Monty Taylor de7fbba912
Set path in cron so we can find ansible-playbook
ansible-playbook is in /usr/local/bin which is not in the path in cron.

Change-Id: I633c021936dfbbfdb022aa3d052fe88f32d2ef6a
2018-08-21 16:55:42 -05:00

22 lines
691 B
YAML

- name: Ensure directory exists for lock files
file:
state: directory
path: /var/run/ansible
- name: Set PATH for cron
cron:
name: PATH
env: yes
value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- name: Set up cron job for running run_all.sh
cron:
name: run_all.sh
state: present
job: 'flock -n /var/run/ansible/run_all.lock bash /opt/system-config/run_all.sh >> /var/log/ansible/run_all_cron.log 2>&1'
minute: "{{ update_cron_interval.minute }}"
hour: "{{ update_cron_interval.hour }}"
day: "{{ update_cron_interval.day }}"
month: "{{ update_cron_interval.month }}"
weekday: "{{ update_cron_interval.weekday }}"