I forgot to say that I want to save all Ansible facts host by host, so “{{ vars }}” contains to much data for me. Here is what I found to remove vars from master and other hosts:
`
name: save all facts to host specific file
copy:
content: “{{ ansible_delegated_vars[inventory_hostname].vars | to_nice_json }}” dest: "/some/directory/{{ ansible_fqdn }}"
delegate_to: localhost
`
This still contains variables from inventory, but it is better than nothing…
I forgot to say that I want to save all Ansible facts *host by host*, so
"{{ vars }}" contains to much data for me. Here is what I found to remove
vars from master and other hosts:
Use the jsonfile ansible cache, it will automatically store facts (and
only facts) into files.
In 2.5 we do have facts under ansible_facts and we hope to ONLY have
them there in the future, currently it is a toggle to allow them in
'main vars' or not.