我正在尝试收集有关 mysql 集群的信息,以便在某些本地逻辑中使用。
我的问题是如果我在远程主机上运行我的命令,我将无法访问这些结果
- 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
Run Code Online (Sandbox Code Playgroud)
这给了我我需要的数据,但我真正想要的是结果的组合列表/字典。
我可以尝试:
- 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',' …Run Code Online (Sandbox Code Playgroud) ansible ×1