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
This commit is contained in:
Ian Wienand 2025-03-11 14:04:20 +11:00
parent 8942ee2b4b
commit a51784a513
No known key found for this signature in database

View File

@ -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