Execution
Date 17 Dec 2025 09:54:56 +0000
Duration 00:04:00.99
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
398 Hosts
4 Tasks
1576 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/zz-vik-447-dockers.yaml

---
- name: List hosts that have Redis Docker containers
  hosts: all
  gather_facts: false
  vars:
    csv_path: "redis_docker_hosts.csv"

  tasks:
    - name: Gather Plesk info
      plesk_info:
      register: plesk_data

    - name: Create CSV header
      ansible.builtin.copy:
        dest: "{{ csv_path }}"
        content: "hostname,container_count,container_images\n"
        mode: "0644"
        force: false
      delegate_to: localhost
      run_once: true

    - name: Save Redis container info to CSV
      ansible.builtin.lineinfile:
        path: "{{ csv_path }}"
        line: "{{ inventory_hostname }},{{ container_count }},{{ images }}"
        insertafter: EOF
      delegate_to: localhost
      when: (container_count | int) > 0
      vars:
        container_count: "{{ plesk_data.redis_containers | length }}"
        images: "{{ plesk_data.redis_containers | map(attribute='image') | join(', ') }}"

    - name: Show hosts with Redis Docker containers
      ansible.builtin.debug:
        msg: "Host {{ inventory_hostname }} has {{ container_count }} Redis Docker container(s): {{ images }}"
      when: (container_count | int) > 0
      vars:
        container_count: "{{ plesk_data.redis_containers | length }}"
        images: "{{ plesk_data.redis_containers | map(attribute='image') | join(', ') }}"