Execution
Date 11 Sep 2024 11:36:27 +0100
Duration 00:00:14.21
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.4
ara 1.7.1 / 1.7.1
Python 3.10.10
Summary
20 Hosts
5 Tasks
100 Results
1 Plays
6 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/test.yaml

---
- name: Parse inventory and save hostnames to a list
  hosts: all
  gather_facts: false
  roles:
    - plesk
  tasks:
    - name: Initialize the list variable
      set_fact:
        matched_hostnames: []

    - name: Check criteria and add hostname to the list
      set_fact:
        matched_hostnames: "{{ matched_hostnames + [ansible_host] }}"
      when: plesk_found

    - name: Print the list of matched hostnames
      debug:
        msg: "{{ matched_hostnames }}"