How do I find which ansible variable belong to which gather_subset group (https://docs.ansible.com/ansible/latest/collections/ansible/builtin/setup_module.html#parameter-gather_subset)?
Following an example to get ansible_hostname. For which I basically did trial and error, but I still don't know if system is the only subset which includes ansible_hostname and moreover if it is the minimal subset.
- name: Test gather facts
gather_facts: true
gather_subset: ["system", "!all", "!min"]
tasks:
- name: Test delegation
- name: Debug
ansible.builtin.debug:
msg:
- "{{ ansible_facts }}"
- "{{ ansible_hostname }}"
of course I could also use a task like
- name: Filter and return only selected facts
ansible.builtin.setup:
filter:
- hostname
to get only the variable ansible_hostname. The thing I don't like here is that it needs to be done as a task and not globally next to gather_facts.