Execution
Date 07 Oct 2025 11:03:51 +0100
Duration 00:00:19.51
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.3 / 1.7.3
Python 3.10.10
Summary
25 Hosts
4 Tasks
96 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/zz-import-raid-reports.yaml

---
- name: Run and fetch raid reports
  hosts: all
  gather_facts: false
  vars:
    remote_dir: /root/raid_summary
    local_base_dir: "raid_reports"
  tasks:
    - name: Run the file to generate report
      ansible.builtin.shell: |
        set -o pipefail
        mkdir -p /root/raid_summary
        rm -f /root/raid_summary/raid_summary.csv
        cd /root
        ./generate_raid_report.sh -w
      args:
        executable: /bin/bash
      changed_when: false

    - name: Create local directory for this host
      delegate_to: localhost
      run_once: true
      ansible.builtin.file:
        path: "{{ local_base_dir }}/{{ inventory_hostname }}"
        state: directory
        mode: '0755'
    - name: Find files in remote directory
      ansible.builtin.find:
        paths: "{{ remote_dir }}"
        file_type: file
      register: remote_files
    - name: Fetch each found file to the local host-specific directory
      ansible.builtin.fetch:
        src: "{{ item.path }}"
        dest: "{{ local_base_dir }}/{{ inventory_hostname }}/{{ item.path | basename }}"
        flat: true
      loop: "{{ remote_files.files }}"