# Pull inventory from spacewalk

**URL:** <https://forum.ansible.com/t/pull-inventory-from-spacewalk/27229>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 10, 2018, 3:43am UTC](https://forum.ansible.com/t/pull-inventory-from-spacewalk/27229 "2018-04-10T03:43:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prakash\_Sharma](https://avatars.discourse-cdn.com/v4/letter/p/7ea924/32.png) [@Prakash\_Sharma](https://forum.ansible.com/u/Prakash_Sharma)\
**Post date:** [April 10, 2018, 3:43am UTC](https://forum.ansible.com/t/pull-inventory-from-spacewalk/27229/1 "2018-04-10T03:43:03Z")

</div>

Hello Team,

Do we have any method to pull inventory from spacewalk into AWX?

I tried to use Redhat Satellite 6 as source , but it failed with below error

2018-04-10 03:33:13,037 INFO awx.main.commands.inventory\_import Updating inventory 2: FromSpacewalk  
2018-04-10 03:33:13,053 DEBUG awx.main.commands.inventory\_import Using system install of ansible-inventory CLI: /usr/bin/ansible-inventory  
2018-04-10 03:33:13,053 INFO awx.main.commands.inventory\_import Reading Ansible inventory source: /usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py  
Traceback (most recent call last):  
File “/usr/bin/awx-manage”, line 9, in   
load\_entry\_point(‘awx==1.0.2.372’, ‘console\_scripts’, ‘awx-manage’)()  
File “/usr/lib/python2.7/site-packages/awx/ **init**.py”, line 109, in manage  
execute\_from\_command\_line(sys.argv)  
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/ **init**.py”, line 364, in execute\_from\_command\_line  
utility.execute()  
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/ **init**.py”, line 356, in execute  
self.fetch\_command(subcommand).run\_from\_argv(self.argv)  
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/base.py”, line 283, in run\_from\_argv  
self.execute(\*args, \*\*cmd\_options)  
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/base.py”, line 330, in execute  
output = self.handle(\*args, \*\*options)  
File “/usr/lib/python2.7/site-packages/awx/main/management/commands/inventory\_import.py”, line 993, in handle  
self.is\_custom)  
File “/usr/lib/python2.7/site-packages/awx/main/management/commands/inventory\_import.py”, line 242, in load\_inventory\_source  
is\_custom=is\_custom).load()  
File “/usr/lib/python2.7/site-packages/awx/main/management/commands/inventory\_import.py”, line 177, in load  
data = self.command\_to\_json(base\_args + [‘–list’])  
File “/usr/lib/python2.7/site-packages/awx/main/management/commands/inventory\_import.py”, line 160, in command\_to\_json  
self.method, proc.returncode, stdout, stderr))  
RuntimeError: ansible-inventory failed (rc=4) with stdout:

stderr:  
ERROR! Could not parse inventory source /usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py with available plugins:  
Plugin script failed: Inventory script (/usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py) had an execution error: Traceback (most recent call last):  
File “/usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py”, line 379, in   
sys.exit(not ForemanInventory().run())  
File “/usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py”, line 374, in run  
self.get\_inventory()  
File “/usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py”, line 327, in get\_inventory  
self.update\_cache()  
File “/usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py”, line 236, in update\_cache  
for host in self.\_get\_hosts():  
File “/usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py”, line 170, in \_get\_hosts  
return self.\_get\_json(“%s/api/v2/hosts” % self.foreman\_url)  
File “/usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py”, line 146, in \_get\_json  
ret = s.get(url, params={‘page’: page, ‘per\_page’: 250})  
File “/var/lib/awx/venv/ansible/lib/python2.7/site-packages/requests/sessions.py”, line 531, in get  
return self.request(‘GET’, url, \*\*kwargs)  
File “/var/lib/awx/venv/ansible/lib/python2.7/site-packages/requests/sessions.py”, line 504, in request  
prep = self.prepare\_request(req)  
File “/var/lib/awx/venv/ansible/lib/python2.7/site-packages/requests/sessions.py”, line 436, in prepare\_request  
hooks=merge\_hooks(request.hooks, self.hooks),  
File “/var/lib/awx/venv/ansible/lib/python2.7/site-packages/requests/models.py”, line 302, in prepare  
self.prepare\_url(url, params)  
File “/var/lib/awx/venv/ansible/lib/python2.7/site-packages/requests/models.py”, line 382, in prepare\_url  
raise MissingSchema(error)  
requests.exceptions.MissingSchema: Invalid URL ‘spacewalk/rhn/systems/Overview.do/api/v2/hosts’: No schema supplied. Perhaps you meant [http://spacewalk/rhn/systems/Overview.do/api/v2/hosts](http://spacewalk/rhn/systems/Overview.do/api/v2/hosts)?

Plugin ini failed: /usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py:24: Expected key=value host variable assignment, got: **future**

Does anyone have better solution for this ?

Regards,  
Prakash.

---

<div class="post-metadata">

**Author:** ![yxfghzui](https://avatars.discourse-cdn.com/v4/letter/y/aeb1de/32.png) [@yxfghzui](https://forum.ansible.com/u/yxfghzui)\
**Post date:** [April 23, 2018, 8:12am UTC](https://forum.ansible.com/t/pull-inventory-from-spacewalk/27229/2 "2018-04-23T08:12:04Z")

</div>

Hello Prashakh,

I’ve faced a similar or identical problem and discovered this site while trying too google the error “Plugin ini failed: /usr/lib/python2.7/site-packages/awx/plugins/inventory/foreman.py:24: Expected key=value host variable assignment, got: **future** ”.

It seems to solely depend on the role configured on Spacewalk / Satellite. View facts and host groups permissions plus view hosts permissions appear to be required. Problems seem to start when trying to filter the role’s rights by host collection. I had some logical errors in there before (filtering hosts by collection without having permissions to view collections), still having some issues even after resolving that (or so I believe) though. Yet, simpler filters work (like, viewing hosts filtered by specific hostnames). So presumably it’s still mostly a matter of wrong role permissions.
