system-config/playbooks/roles/ansible-cron/tasks/main.yaml
Ian Wienand e9ca0bc9ad Ensure lockfile dir is created for bridge.o.o
After we reboot the lockfile directory disappears.  Recreate it before
running the puppet that would create it anyway.

Change-Id: Ia0779240b9e516090237dfbe61404fab114c6d4a
2019-03-15 09:36:56 +11:00

31 lines
1005 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
# Note /var/run is ephemeral; so after a reboot we need to
# ensure the lockfile dir is there before we run...
job: 'mkdir -p /var/run/ansible; flock -n /var/run/ansible/run_all.lock bash /opt/system-config/run_all.sh -c >> /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 }}"
when: ansible_cron_install_cron
- name: Setup log rotation
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/ansible/run_all_cron.log