From 759015f101fa2cf946672dc351d153a0bfd9cd09 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 11 Aug 2018 07:35:11 -0500 Subject: [PATCH] Start running puppet cron on bridge.openstack.org Puppet cron is no longer being run on puppetmaster (yay!) so start running it in cron from bridge. Change-Id: Idc579a2660a5450092544c21a2e9e6cb9688e5f9 --- .../openstack_project/manifests/puppetmaster.pp | 6 ------ playbooks/bridge.yaml | 1 + playbooks/roles/ansible-cron/defaults/main.yaml | 6 ++++++ playbooks/roles/ansible-cron/tasks/main.yaml | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 playbooks/roles/ansible-cron/defaults/main.yaml create mode 100644 playbooks/roles/ansible-cron/tasks/main.yaml diff --git a/modules/openstack_project/manifests/puppetmaster.pp b/modules/openstack_project/manifests/puppetmaster.pp index e4d043f7e7..91da7844dd 100644 --- a/modules/openstack_project/manifests/puppetmaster.pp +++ b/modules/openstack_project/manifests/puppetmaster.pp @@ -3,12 +3,6 @@ class openstack_project::puppetmaster ( $puppetmaster_clouds, $root_rsa_key = 'xxx', - $puppetmaster_update_cron_interval = { min => '*/15', - hour => '*', - day => '*', - month => '*', - weekday => '*', - }, ) { include logrotate diff --git a/playbooks/bridge.yaml b/playbooks/bridge.yaml index 90c9d73a05..35623d3e34 100644 --- a/playbooks/bridge.yaml +++ b/playbooks/bridge.yaml @@ -3,3 +3,4 @@ - pip3 - install-ansible - root-keys + - ansible-cron diff --git a/playbooks/roles/ansible-cron/defaults/main.yaml b/playbooks/roles/ansible-cron/defaults/main.yaml new file mode 100644 index 0000000000..b3e04e1676 --- /dev/null +++ b/playbooks/roles/ansible-cron/defaults/main.yaml @@ -0,0 +1,6 @@ +update_cron_interval: + minute: '*/15' + hour: '*' + day: '*' + month: '*' + weekday: '*' diff --git a/playbooks/roles/ansible-cron/tasks/main.yaml b/playbooks/roles/ansible-cron/tasks/main.yaml new file mode 100644 index 0000000000..02d90e5110 --- /dev/null +++ b/playbooks/roles/ansible-cron/tasks/main.yaml @@ -0,0 +1,15 @@ +- name: Ensure directory exists for lock files + file: + state: directory + path: /var/run/ansible + +- 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 }}"