Something like this could do the trick
- name: Dump vars
hosts: all
connection: local
gather_facts: True
tasks:
- name: Dump hostvars
delegate_to: localhost
copy:
content: "{{ hostvars[inventory_hostname] | to_nice_json }}"
dest: /tmp/setup-{{ inventory_hostname }}.json
when:
- debug_mode | d(True) | bool
If debug_mode is enabled, it will generate a /tmp/setup-$(hostname).json
file with facts gathered in the ansible control machine.
Regards,
El vie, 26 mar 2021 a las 16:38, Somasundaram R (<[email protected]>)
escribió:
> use ansible-cmdb.
>
> https://ansible-cmdb.readthedocs.io/en/latest/#:~:text=Ansible%2Dcmdb%20takes%20the%20output,by%20Ansible%20with%20custom%20data
> .
>
> On Friday, 26 March 2021 at 21:01:48 UTC+5:30 [email protected] wrote:
>
>> Hi all
>>
>> Is there a way to store facts like (mem,CPU,HD etc ) to a txt file ?
>>
>> Thanks !
>> Marcio X
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5d14487a-2b9d-44cf-a3c5-bd5b2cf51f11n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/5d14487a-2b9d-44cf-a3c5-bd5b2cf51f11n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAFtje5Od-WSVnSH4K5eTaUHKgRFreKWoot5Us_kP8xrRzwN-xQ%40mail.gmail.com.