Execution
Date 17 Dec 2025 09:28:03 +0000
Duration 00:04:01.45
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
1582 Results
1 Plays
1 Files
0 Records

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

---
- name: Check Plesk servers for Redis installations
  hosts: all
  gather_facts: false
  vars:
    csv_path: "redis_report.csv"

  tasks:
    - name: Gather Plesk and Redis information
      plesk_info:
      register: plesk_data

    - name: Ensure CSV exists with header (run once)
      ansible.builtin.copy:
        dest: "{{ csv_path }}"
        content: "hostname,redis_type,redis_pkg_version,redis_container_count,redis_container_versions\n"
        mode: "0644"
        force: false
      delegate_to: localhost
      run_once: true

    - name: Parse Docker Redis versions
      ansible.builtin.set_fact:
        redis_container_versions: >-
          {{
            plesk_data.redis_containers
            | map(attribute='image')
            | map('regex_replace', '^.*:(.*)$', '\\1')
            | list
            | join(',')
          }}
      when: plesk_data.redis_containers | length > 0

    - name: Append Redis info to CSV
      ansible.builtin.lineinfile:
        path: "{{ csv_path }}"
        line: "{{ inventory_hostname }},{{ redis_type }},{{ redis_pkg_version }},{{ container_count }},{{ redis_container_versions | default('') }}"
        insertafter: EOF
      delegate_to: localhost
      when: redis_save | bool
      vars:
        redis_type: "{{ ('both' if (plesk_data.redis_found and (plesk_data.redis_containers | length > 0))
                        else 'standalone' if plesk_data.redis_found
                        else 'docker' if (plesk_data.redis_containers | length > 0)
                        else 'none') }}"

        redis_pkg_version: "{{ plesk_data.redis_version | default('') }}"
        container_count: "{{ plesk_data.redis_containers | length }}"
        redis_save: "{{ plesk_data.redis_found or (plesk_data.redis_containers | length > 0) }}"