From c5263d76c97560bd95f900347b327fa3d233eb69 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 7 Apr 2020 09:04:18 -0700 Subject: [PATCH] Improving logging of prod playbook jobs This updates prod playbook jobs to curate a set of logs on bridge if we aren't publishing them to zuul. This way we have history on the bastion server. Change-Id: I73889754155298a8554ddc17bb413ae7764b9eae --- playbooks/zuul/run-production-playbook.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/playbooks/zuul/run-production-playbook.yaml b/playbooks/zuul/run-production-playbook.yaml index f680bbdbdf..a6db956efd 100644 --- a/playbooks/zuul/run-production-playbook.yaml +++ b/playbooks/zuul/run-production-playbook.yaml @@ -53,3 +53,18 @@ url: "{{ playbook_name }}.log" metadata: type: text + + # If we aren't publishing logs through zuul then keep a set on + # bridge directly. + - name: Rename playbook log on bridge + when: not infra_prod_playbook_collect_log + copy: + remote_src: yes + src: "/var/log/ansible/{{ playbook_name }}.log" + dest: "/var/log/ansible/{{ playbook_name }}.log.{{ ansible_date_time.iso8601 }}" + + - name: Cleanup old playbook logs on bridge + when: not infra_prod_playbook_collect_log + shell: | + find /var/log/ansible -name '{{ playbook_name }}.log.*' -type f -mtime 30 -delete +