system-config/playbooks/roles/ansible-cron/tasks/main.yaml
Ian Wienand 97a3ab9bf3 Add statsd metrics for ansible runs
Add some coarse-grained statsd tracking for the global ansible runs.
Adds a timer for each step, along with an overall timer.

This adds a single argument so that we only try to run stats when
running from the cron job (so if we're debugging by hand or something,
this doesn't trigger).  Graphite also needs to accept stats from
bridge.o.o.  The plan is to present this via a simple grafana
dashboard.

Change-Id: I299c0ab5dc3dea4841e560d8fb95b8f3e7df89f2
2018-09-10 14:49:45 +10:00

27 lines
824 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 -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 }}"
- name: Setup log rotation
include_role:
name: logrotate
vars:
logrotate_file_name: /var/log/ansible/run_all_cron.log