facts module output in setup?

110 views
Skip to first unread message

Guy Matz

unread,
Jan 14, 2015, 1:53:13 PM1/14/15
to ansible...@googlegroups.com
Hello!  Is it possible to get a fact module to be included in the output for the setup module using ansible, i.e. not from a play?  Perhaps I'm not asking this question correctly . . .  I would like to extend setup to retrieve info about my servers so that running 'ansible -m setup host' would give me the usual output from setup, plus the additional facts . . .   Anyone know if it's possible and possible have an example handy?

Thanks a lot,
Guy

Brian Coca

unread,
Jan 14, 2015, 2:33:51 PM1/14/15
to ansible...@googlegroups.com
You can add a script that returns json to /etc/ansible/facts.d on the
target servers, default fact gathering will read/execute these.




--
Brian Coca

Guy Matz

unread,
Jan 14, 2015, 2:35:05 PM1/14/15
to ansible...@googlegroups.com
Thanks, yeah . . . I was hoping to not have to distribute scripts out, but rather keep them in a /library dir . . .





--
Brian Coca

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8nKmTH3y7qWU8j2gO2ssTh%2B_z0XebiMR9OWF0%2Bxhm0w8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Brian Coca

unread,
Jan 14, 2015, 2:36:03 PM1/14/15
to ansible...@googlegroups.com
you can do that but it would be it's own module, you would have to
execute it instead of setup.


--
Brian Coca

Guy Matz

unread,
Jan 14, 2015, 2:56:07 PM1/14/15
to ansible...@googlegroups.com
Right!  So!!  Anyone know if there's a way to include the contents of the setup module in my module?  Thanks!



--
Brian Coca

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Wilco Eliveld

unread,
May 21, 2015, 1:46:11 PM5/21/15
to ansible...@googlegroups.com
Any updates on this? i need custom facts to get information from my hosts but i dont want to install the facts on all the servers.
is it possible to create a addon for module setup?

Brian Coca

unread,
May 21, 2015, 1:53:46 PM5/21/15
to ansible...@googlegroups.com
fact gathering is actually shared code any module can execute by using
module_util/facts.py the same way you use basic.py for the module
class
> https://groups.google.com/d/msgid/ansible-project/9de1f9a9-e236-4dde-8123-9722dd84e6e4%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Brian Coca
Reply all
Reply to author
Forward
0 new messages