setup
1、获取setup的所有信息,获取的信息有上百条:
ansible all -m setup
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"172.xx.xx.xxx"
],
"ansible_all_ipv6_addresses": [
"fe80::250:56ff:febc:5e1d"
],
..........................................
..........................................
"module_setup": true
},
"changed": false
}
2、对查询的结果进行筛选:
ansible all -m setup -a 'filter=ansible_*_mb'
3、将每台主机的信息,分别存放到特定目录中,文件名为hosts文件中对应的别名或IP:
ansible all -m setup --tree /tmp/facts
stat
4、获取文件的详细信息:
ansible all -m stat -a "path=/root/test.sh"