From a51784a5139f1f7ee902651c3fb735428e3a4570 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 11 Mar 2025 14:04:20 +1100 Subject: [PATCH] run-production-playbook: redirect via ansible logger Currently this logs to /var/log/ansible.log via the log_path setting in the Ansible config, and we also redirect output to a file. The stdout dump is the primary debugging method, and contains the same info as what is put into /var/log/ansible.log by Ansible logging. Instead, set ANSIBLE_LOG_PATH to /dev/null these logs, and just save the stdout output. While we're here, save stderr too. This way if you manually run Ansible on bridge you've got logging by default, but this should stop multiple runs of production Ansible via Zuul all mushing together thier output into a fairly useless global log file. Change-Id: Iae32f501dc718f9bbfd403c6857ca7c8dc8767de --- playbooks/zuul/run-production-playbook.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/playbooks/zuul/run-production-playbook.yaml b/playbooks/zuul/run-production-playbook.yaml index b139c083f3..c40e2700f4 100644 --- a/playbooks/zuul/run-production-playbook.yaml +++ b/playbooks/zuul/run-production-playbook.yaml @@ -18,8 +18,12 @@ - name: Run specified playbook on bastion host and redirect output become: yes - shell: 'ansible-playbook -v -f {{ infra_prod_ansible_forks }} /home/zuul/src/opendev.org/opendev/system-config/playbooks/{{ playbook_name }} >> /var/log/ansible/{{ playbook_name }}.log' + shell: 'ansible-playbook -v -f {{ infra_prod_ansible_forks }} /home/zuul/src/opendev.org/opendev/system-config/playbooks/{{ playbook_name }} >> /var/log/ansible/{{ playbook_name }}.log 2>&1' register: _run + environment: + # Override the global config for zuul induced runs to not + # have a mixed-up ever-growing /var/log/ansible.log. + ANSIBLE_LOG_PATH: '/dev/null' always: - name: Send run stats