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

Reply via email to