Yeah that seems fine.

You will want to turn off "gather_facts" and call it explicitly.

What you are doing with site facts is a little weird, most folks would
probably do a fact module and rather than calling it twice, split different
things into different modules.




On Wed, Sep 10, 2014 at 12:54 PM, ProfHase <[email protected]> wrote:

> Sorry for the confusion.
> I got a custom fact script on the remote machine.
>
> /etc/ansible/facts.d/node_guid.fact
>
> which looks like this:
>
> #! /usr/bin/env python
> import sys
> import json
>
> def get_prop(line):
>     return line.split("=")[1].strip()
>
> try:
>     f = open('/etc/zypp/credentials.d/NCCcredentials')
> except IOError:
>     print("{}")
>     sys.exit(0)
>
> context = {}
> keys = ['username']
>
> for line in f:
>     for key in keys:
>         if line.startswith(key):
>             context[key] = get_prop(line)
>
> print json.dumps(context)
> sys.exit(0)
>
> '/etc/zypp/credentials.d/NCCcredentials' is set readable only for root.
> Therefore 'node_guid.fact' only returns facts as sudo. Which is the reason
> why I call the setup module with `sudo:yes`
>
>  --
> 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/d8c410ce-bbdf-49c6-bce5-ccaaf712405d%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/d8c410ce-bbdf-49c6-bce5-ccaaf712405d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgwpP7uuHpQ-2vhzxceLcfU3XcpwN_nG9Oq-TzK%2Bi3GuYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to