I want to use this Inventory Script in AWX that connect to my satellite server to generate dynamic inventories.
But when I execute update of the inventory, it appears this error.
1
1.452 INFO Updating inventory 15: Inventory_Satellite
2
1.462 DEBUG Using system install of ansible-inventory CLI: /usr/bin/ansible-inventory
3
1.462 INFO Reading Ansible inventory source: /tmp/awx_46_DXibrf/tmplbx1AV
4
Traceback (most recent call last):
5
File “/usr/bin/awx-manage”, line 9, in
6
load_entry_point(‘awx==1.0.8.0’, ‘console_scripts’, ‘awx-manage’)()
7
File “/usr/lib/python2.7/site-packages/awx/init.py”, line 116, in manage
8
execute_from_command_line(sys.argv)
9
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/init.py”, line 364, in execute_from_command_line
10
utility.execute()
11
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/init.py”, line 356, in execute
12
self.fetch_command(subcommand).run_from_argv(self.argv)
13
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/base.py”, line 283, in run_from_argv
14
self.execute(*args, **cmd_options)
15
File “/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/base.py”, line 330, in execute
16
output = self.handle(*args, **options)
17
File “/usr/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py”, line 994, in handle
18
self.is_custom)
19
File “/usr/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py”, line 245, in load_inventory_source
20
is_custom=is_custom).load()
21
File “/usr/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py”, line 180, in load
22
data = self.command_to_json(base_args + [‘–list’])
23
File “/usr/lib/python2.7/site-packages/awx/main/management/commands/inventory_import.py”, line 163, in command_to_json
24
self.method, proc.returncode, stdout, stderr))
25
RuntimeError: ansible-inventory failed (rc=1) with stdout:
26
27
stderr:
28
[WARNING]: * Failed to parse /tmp/awx_46_DXibrf/tmplbx1AV with script plugin:
29
Inventory script (/tmp/awx_46_DXibrf/tmplbx1AV) had an execution error: Error
30
parsing configuration: No section: ‘foreman’
31
32
[WARNING]: Unable to parse /tmp/awx_46_DXibrf/tmplbx1AV as an inventory source
33
34
ERROR! No inventory was parsed, please check your configuration and options.
INVENTORY SCRIPT
#!/usr/bin/env python