Use o módulo set_fact
e hostvars
:
---
- hosts: all
vars:
uuids: |
{%- set o=[] %}
{%- for i in play_hosts %}
{%- if o.append(hostvars[i].uuid) %}
{%- endif %}
{%- endfor %}
{{ o }}
tasks:
- name: get uuids for existing cluster nodes
shell: mysql -N -B -u {{ db_user }} -p {{ db_user_password }} -e "SHOW GLOBAL STATUS LIKE 'wsrep_cluster_state_uuid';" | sed 's/\t/,/g' | cut -f2 -d','
register: maria_cluster_uuids
- set_fact:
uuid: "{{ maria_cluster_uuids.stdout }}"
- debug:
var: uuids
run_once: true
delegate_to: 127.0.0.1