Is there a way for me to specify the only fact I care about gathering? I have a server that is giving me grief due to the way its disks are setup (tons of nfs shares, etc)… at least I assume that is why it is giving me grief. I just need to gather the ansible_hostname fact.
The most minimal you can do, and still get that would be to define:
gather_subset: platform
It will include ansible_hostname, plus a few extras.
The following works on the command line, but I can’t seem to find the right syntax to put it into a playbook:
`
root@ansible:/playbooks # ansible -m setup -a ‘filter=ansible_hostname’ ansible-oel6
ansible-oel6 | SUCCESS => {
“ansible_facts”: {
“ansible_hostname”: “ansible-oel6”
},
“changed”: false
}
`
Thanks Matt. It seems platform and !all,min equate to the same thing. I tried the following in my playbook and it works:
`
pre_tasks:
- setup:
gather_subset: min
filter: ansible_hostname
`
gather_subset is also allowed on the play[1] level.
- hosts: all
gather_subset: min
[1] https://docs.ansible.com/ansible/latest/playbooks_keywords.html#play