Get information about remote hosts using Ansible setup command
Below command gives all the information of client hosts which includes memory, server architecture, IP adresses etc.
[root@ansible mywork]# ansible all -i hosts -m setup
If you need just memory information of remote node then for the above command need to add filter as shown below
[root@ansible mywork]# ansible all -i hosts -m setup -a "filter=ansible_*_mb"
node01 | SUCCESS => {
"ansible_facts": {
"ansible_memfree_mb": 873,
"ansible_memory_mb": {
"nocache": {
"free": 919,
"used": 77
},
"real": {
"free": 873,
"total": 996,
"used": 123
},
"swap": {
"cached": 0,
"free": 1535,
"total": 1535,
"used": 0
}
},
"ansible_memtotal_mb": 996,
"ansible_swapfree_mb": 1535,
"ansible_swaptotal_mb": 1535
},
"changed": false
Below command gives all the information of client hosts which includes memory, server architecture, IP adresses etc.
[root@ansible mywork]# ansible all -i hosts -m setup
If you need just memory information of remote node then for the above command need to add filter as shown below
[root@ansible mywork]# ansible all -i hosts -m setup -a "filter=ansible_*_mb"
node01 | SUCCESS => {
"ansible_facts": {
"ansible_memfree_mb": 873,
"ansible_memory_mb": {
"nocache": {
"free": 919,
"used": 77
},
"real": {
"free": 873,
"total": 996,
"used": 123
},
"swap": {
"cached": 0,
"free": 1535,
"total": 1535,
"used": 0
}
},
"ansible_memtotal_mb": 996,
"ansible_swapfree_mb": 1535,
"ansible_swaptotal_mb": 1535
},
"changed": false
Comments
Post a Comment