Problem when I try to migrate ansible-inventory to awx

26 views
Skip to first unread message

Arturo Ibáñez González

unread,
Aug 9, 2019, 10:26:20 AM8/9/19
to Ansible Project
Hi guys ,

When I try to import my ansible-inventory and put in AWX with this command:

sudo -u awx /opt/awx/bin/awx-manage inventory_import --source=/etc/ansible/inventory/production/hosts --inventory-name=production

I had this output with this error :

    8.777 INFO     Updating inventory 4: production
   
9.056 INFO     Reading Ansible inventory source: /etc/ansible/inventory/production/hosts
Traceback (most recent call last):
 
File "/opt/awx/bin/awx-manage", line 11, in <module>
    sys
.exit(manage())
...
 
File "/opt/awx/embedded/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py", line 245, in load_inventory_source
    is_custom
=is_custom).load()
 
File "/opt/awx/embedded/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py", line 180, in load
    data
= self.command_to_json(base_args + ['--list'])
 
File "/opt/awx/embedded/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py", line 163, in command_to_json
   
self.method, proc.returncode, stdout, stderr))
RuntimeError: ansible-inventory failed (rc=1) with stdout:
 
Traceback (most recent call last):
 
File "/bin/ansible-inventory", line 32, in <module>
   
from ansible import context
ImportError: cannot import name context


And my specs in vm (CentOS Linux 7.6.1810 64bit / Linux 3.10.0-957.21.3.el7.x86_64) and ansible version are
# ansible --version
ansible
2.8.2
  config file
= /etc/ansible/ansible.cfg
  configured
module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python
module location = /usr/lib/python2.7/site-packages/ansible
  executable location
= /usr/bin/ansible
  python version
= 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
You have new mail in /var/spool/mail/root

Can help me for workaround this problem and try to import data.

Thanks

Kai Stian Olstad

unread,
Aug 9, 2019, 8:32:43 PM8/9/19
to ansible...@googlegroups.com
On 09.08.2019 16:26, Arturo Ibáñez González wrote:
> Hi guys ,
>
> When I try to import my ansible-inventory and put in AWX with this command:
>
> sudo -u awx /opt/awx/bin/awx-manage inventory_import --source=/etc/ansible/
> inventory/production/hosts --inventory-name=production
AWX has it's one list, please use that, this list is only for Ansible.


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages