Reputation: 25
I would like to have a minimal fact gathering that would only. I'm actually only interested in accessing the variables defined in ansible_env.
I've tried to use the setup module with filter: ansible_env and gather_subset: min but It didn't work for me...
any hint would be greatly appreciated
Thanks!
Upvotes: 2
Views: 5310
Reputation: 291
Instead of creating a playbook just for that, you can execute an Ansible command like the following, in order to retrieve specific facts:
ansible <hostname> -m setup -a "filter=ansible_distribution"
Upvotes: 3
Reputation: 168
I report below a minimal example:
- hosts: localhost
gather_facts: false
tasks:
- setup:
filter: ansible_env
- debug:
var=ansible_env
Upvotes: 1