Chunk up ceph-ansible output to prevent clogging the CLI
The CLI commands running Ansible can crash if we send too much single-line log output their way. This was happening on upgrades, when we run Ansible with verbosity level 1. The fix is twofold: * If ceph-ansible finishes successfully, we don't print the ceph-ansible output into the main log. * If ceph-ansible fails, we do print the output, but we print it line-by-line, which should give us much better readability than before, and we shouldn't break the limits of the Mistral-Zaqar-CLI message passing. Change-Id: I6e0fc36749e74fce25f414c2547e49e2a20437ab Closes-Bug: #1795689
This commit is contained in:
parent
51410f0e88
commit
a0ead2f1a7
@ -548,9 +548,23 @@ outputs:
|
||||
- '{{playbook_dir}}/ceph-ansible/inventory.yml'
|
||||
- '--extra-vars'
|
||||
- '@{{playbook_dir}}/ceph-ansible/extra_vars.yml'
|
||||
- name: run ceph-ansible
|
||||
with_items: "{{ceph_ansible_playbooks}}"
|
||||
shell: "{{ceph_ansible_command}} {{item}}"
|
||||
- name: run ceph-ansible (immediate log at {{playbook_dir}}/ceph-ansible/ceph_ansible_command.log)
|
||||
shell: |
|
||||
set -e
|
||||
{% for playbook in ceph_ansible_playbooks %}
|
||||
echo "Running ceph-ansible playbook {{playbook}}"
|
||||
{{ceph_ansible_command}} {{playbook}} 2>&1
|
||||
{% endfor %}
|
||||
# We want the output chunked into bits to prevent
|
||||
# overflowing Zaqar message size
|
||||
no_log: true
|
||||
failed_when: false
|
||||
register: outputs
|
||||
- name: print ceph-ansible output in case of failure
|
||||
debug:
|
||||
var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([]))
|
||||
failed_when: outputs.rc != 0
|
||||
when: outputs.rc != 0
|
||||
- name: create ceph-ansible fetch directory tarball in local backup
|
||||
archive:
|
||||
path: "{{playbook_dir}}/ceph-ansible/fetch_dir"
|
||||
|
Loading…
Reference in New Issue
Block a user