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’])