On Saturday, 17 February 2018 09.38.24 CET YvanM wrote:
> Running Ansible 2.4, I am trying to save *all* Ansible facts to a file, 
> with a task like this:
> 
> - name: save all facts to host specific file
>   copy:
>     content: "{{ ansible_facts }}"
>     dest: "/some/directory/{{ ansible_fqdn }}"
>   delegate_to: localhost
> 
> However it fails with the error "'ansible_facts' is undefined".
> 
> Do you think there is a workaround? I really do not want to have to select 
> facts one by one…

The facts is not stored under "ansible_facts" but "vars" so use

  content: '{{ vars }}'


-- 
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/4487448.p9Gxs80oTR%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to