Remove run_all.sh and ansible cron job
Remove the script and the cronjob on bridge that runs it. Change-Id: I45e4d9713f3ba4760ba384d13487c6214d068800
This commit is contained in:
parent
c8aeaf8fd1
commit
589521fd18
@ -12,19 +12,4 @@
|
||||
- name: Set up cron job for running run_all.sh
|
||||
cron:
|
||||
name: run_all.sh
|
||||
state: present
|
||||
disabled: "{{ ansible_cron_disable_job }}"
|
||||
# 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 }}"
|
||||
|
||||
- name: Setup log rotation
|
||||
include_role:
|
||||
name: logrotate
|
||||
vars:
|
||||
logrotate_file_name: /var/log/ansible/run_all_cron.log
|
||||
state: absent
|
||||
|
@ -10,7 +10,7 @@
|
||||
# the test-node tenants have hundreds of ephemeral nodes, whose
|
||||
# cache-evading behaviour would make enumerating their projects
|
||||
# unnecessarily slow when building an inventory for our default
|
||||
# control-plane cron runs (run_all.sh).
|
||||
# control-plane cron runs.
|
||||
#
|
||||
|
||||
ansible:
|
||||
|
78
run_all.sh
78
run_all.sh
@ -1,78 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# If updating the puppet system-config repo or installing puppet modules
|
||||
# fails then abort the puppet run as we will not get the results we
|
||||
# expect.
|
||||
set -e
|
||||
|
||||
SYSTEM_CONFIG=/opt/system-config
|
||||
ANSIBLE_PLAYBOOKS=$SYSTEM_CONFIG/playbooks
|
||||
|
||||
# We only send stats if running under cron
|
||||
UNDER_CRON=0
|
||||
|
||||
while getopts ":c" arg; do
|
||||
case $arg in
|
||||
c)
|
||||
UNDER_CRON=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
GLOBAL_START_TIME=$(date '+%s')
|
||||
|
||||
# Send a timer stat to statsd
|
||||
# send_timer metric [start_time]
|
||||
# * uses timer metric bridge.ansible.run_all.<$1>
|
||||
# * time will be taken from last call of start_timer, or $2 if set
|
||||
function send_timer {
|
||||
# Only send stats under cron conditions
|
||||
if [[ ${UNDER_CRON} != 1 ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local current
|
||||
current=$(date '+%s')
|
||||
local name
|
||||
name=$1
|
||||
local start
|
||||
start=${2-$_START_TIME}
|
||||
local elapsed_ms
|
||||
elapsed_ms=$(( (current - start) * 1000 ))
|
||||
|
||||
echo "bridge.ansible.run_all.${name}:${elapsed_ms}|ms" | nc -w 1 -u graphite.opendev.org 8125
|
||||
echo "End $name"
|
||||
}
|
||||
# See send_timer
|
||||
function start_timer {
|
||||
_START_TIME=$(date '+%s')
|
||||
}
|
||||
|
||||
echo "--- begin run @ $(date -Is) ---"
|
||||
|
||||
# It's possible for connectivity to a server or manifest application to break
|
||||
# for indeterminate periods of time, so the playbooks should be run without
|
||||
# errexit
|
||||
set +e
|
||||
|
||||
# DO NOTHING!!!
|
||||
|
||||
# Send the combined time for everything
|
||||
send_timer total $GLOBAL_START_TIME
|
||||
|
||||
echo "--- end run @ $(date -Is) ---"
|
||||
echo
|
@ -158,9 +158,6 @@ def test_logrotate(host):
|
||||
cfg_file = host.file("/etc/logrotate.d/ansible.log.37237.conf")
|
||||
assert cfg_file.exists
|
||||
assert cfg_file.contains('/var/log/ansible/ansible.log')
|
||||
cfg_file = host.file("/etc/logrotate.d/run_all_cron.log.1a953.conf")
|
||||
assert cfg_file.exists
|
||||
assert cfg_file.contains('/var/log/ansible/run_all_cron.log')
|
||||
|
||||
|
||||
def test_no_recommends(host):
|
||||
|
@ -45,12 +45,6 @@ def test_openstacksdk_config(host):
|
||||
assert f.mode == 0o640
|
||||
|
||||
|
||||
def test_ansible_run_all_cron(host):
|
||||
with host.sudo():
|
||||
crontab = host.check_output('crontab -l')
|
||||
assert 'run_all.sh' in crontab
|
||||
|
||||
|
||||
def test_cloud_launcher_cron(host):
|
||||
with host.sudo():
|
||||
crontab = host.check_output('crontab -l')
|
||||
|
Loading…
Reference in New Issue
Block a user