I did not think about registering results of "setup" task, that is perfect!
Thanks,
Yvan
Le samedi 17 février 2018 12:00:46 UTC+1, Kai Stian Olstad a écrit :
>
> On Saturday, 17 February 2018 11.34.19 CET YvanM wrote:
> > Thanks for the hint!
> >
> > 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:
>
> Look into the facts caching feature of Ansible, that will only store the
> gathered facts and not inventory in one file per host.
>
> https://docs.ansible.com/ansible/latest/playbooks_variables.html#fact-caching
>
>
> > - 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…
>
> This will also only store the gathered facts and not inventory
>
> - setup:
> register: setupvar
>
> - copy:
> content: '{{ setupvar.ansible_facts }}'
> dest: /some/directory/{{ ansible_fqdn }}
> delegate_to: localhost
>
>
> --
> Kai Stian Olstad
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/bbd237fb-b2dc-4522-b7b1-c796e78b2c64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.