Hi,
 most of example inventory scripts expect that service run on same server 
as Ansible, as this is very unlikely I use simple workaround for Spacewalk 
(replace SW_REPORT with own script which calls Spacewalk server via 
Ansible). I would like to humbly ask for some modification of Spacewalk 
inventory script from some Python programmer - to allow also remote calls. 
I presume that anybody who use Spacewalk as a backend need this/already do 
such modification in better way than my hack.

Thanks for hints

Vasek


My "workaround right now":


spacewalk.py
SW_REPORT = '/usr/local/bin/remote_spacewalk.py'

remote_spacewalk.py

#!/usr/bin/python

import ansible.runner
import sys

cmdargs = str(sys.argv)

# construct the ansible runner and execute on all hosts
results = ansible.runner.Runner(
    pattern='spacewalk-master*',
    forks=1,
    remote_user='ansible',
    sudo=True,
    module_name='command',
    module_args="/usr/bin/spacewalk-report %s" % str(sys.argv[1]),
).run()

if results is None:
   print "No spacewalk server found"
   sys.exit(1)

for (hostname, result) in results['contacted'].items():
    if not 'failed' in result:
        print "%s" % (result['stdout'])

-- 
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/21513cff-d60a-4ade-a4d4-e18e9b25de8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to