From 7a18eb49e4fcaf3b18288ae4e12a17cff6a017be Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 8 Mar 2019 21:18:20 +0000 Subject: [PATCH] Add flag to disable cron for test jobs The run_all cron running in test jobs is unawesome because it can cause the inventory overrides we put in for the testing to get overwritten with the real inventory. We don't want test jobs attempting to run against real hosts. Change-Id: I733f66ff24b329d193799e6063953e88dd6a35b1 --- playbooks/roles/ansible-cron/defaults/main.yaml | 2 ++ playbooks/roles/ansible-cron/tasks/main.yaml | 3 ++- .../zuul/templates/host_vars/bridge.openstack.org.yaml.j2 | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/playbooks/roles/ansible-cron/defaults/main.yaml b/playbooks/roles/ansible-cron/defaults/main.yaml index b3e04e1676..4d21c72b6c 100644 --- a/playbooks/roles/ansible-cron/defaults/main.yaml +++ b/playbooks/roles/ansible-cron/defaults/main.yaml @@ -4,3 +4,5 @@ update_cron_interval: day: '*' month: '*' weekday: '*' +# Flag that can be set in tests to ensure cron is not run +ansible_cron_install_cron: true diff --git a/playbooks/roles/ansible-cron/tasks/main.yaml b/playbooks/roles/ansible-cron/tasks/main.yaml index 4e65e12b67..f3724c815d 100644 --- a/playbooks/roles/ansible-cron/tasks/main.yaml +++ b/playbooks/roles/ansible-cron/tasks/main.yaml @@ -19,9 +19,10 @@ 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 \ No newline at end of file + logrotate_file_name: /var/log/ansible/run_all_cron.log diff --git a/playbooks/zuul/templates/host_vars/bridge.openstack.org.yaml.j2 b/playbooks/zuul/templates/host_vars/bridge.openstack.org.yaml.j2 index d464f38c65..8a10d384ac 100644 --- a/playbooks/zuul/templates/host_vars/bridge.openstack.org.yaml.j2 +++ b/playbooks/zuul/templates/host_vars/bridge.openstack.org.yaml.j2 @@ -59,3 +59,4 @@ clouds: openstackzuul_arm64ci_password: password openstackzuul_arm64ci_project_name: project gitea_kube_key: Z2l0ZWFfazhzX2tleQ== +ansible_cron_install_cron: false