gather-ceph-logs: fix logs list generation

The shell module doesn't have a stdout_lines attributes. Instead of
using the shell module, we can use the find modules.

Also adding `become: false` to the local tmp directory creation
otherwise we won't have enough right to fetch the files into this
directory.

Resolves: #3966

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
(cherry picked from commit ea1f8f551c)
pull/3981/head
Dimitri Savineau 2019-05-13 10:12:42 -04:00 committed by Dimitri Savineau
parent 6a48ff8a37
commit 6814fd5ce5
1 changed files with 7 additions and 8 deletions

View File

@ -23,20 +23,19 @@
prefix: ceph_ansible prefix: ceph_ansible
run_once: true run_once: true
register: localtempfile register: localtempfile
become: false
- name: set_fact lookup_ceph_config - lookup keys, conf and logs - name: set_fact lookup_ceph_config - lookup keys, conf and logs
shell: ls -1 {{ item }} find:
paths:
- /etc/ceph
- /var/log/ceph
register: ceph_collect register: ceph_collect
changed_when: false
with_items:
- /etc/ceph/*
- /var/log/ceph/*
- name: collect ceph logs, config and keys in "{{ localtempfile.path }}" on the machine running ansible - name: collect ceph logs, config and keys in "{{ localtempfile.path }}" on the machine running ansible
fetch: fetch:
src: "{{ item }}" src: "{{ item.path }}"
dest: "{{ localtempfile.path }}" dest: "{{ localtempfile.path }}"
fail_on_missing: no fail_on_missing: no
flat: no flat: no
with_items: with_items: "{{ ceph_collect.files }}"
- "{{ ceph_collect.stdout_lines }}"