I'm trying to gather information on a mysql cluster in order to then use in some local logic.
My trouble is if I run my command on the remote hosts I won't have access to those results
- 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
This gives me the data I need but what I'd really like is a combined list/dict of the results.
I could try:
- name: get uuids for existing cluster nodes
run_once: true
shell: mysql -N -B -u {{ db_user }} -h {{ item }} -p {{ db_user_password }} -e "SHOW GLOBAL STATUS LIKE 'wsrep_cluster_state_uuid';" | sed 's/\t/,/g' | cut -f2 -d','
register: maria_cluster_uuids
with_items: play_hosts
delegate_to: 127.0.0.1
however, mysql kicks up a warning and to be honest, I don't want to impose a requirement of the local machine having a mysql client installed.
Nasty feeling I'm going to have to write some python here...