# Cannot run my inventory script in AWX

**URL:** <https://forum.ansible.com/t/cannot-run-my-inventory-script-in-awx/33236>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [June 23, 2020, 4:02pm UTC](https://forum.ansible.com/t/cannot-run-my-inventory-script-in-awx/33236 "2020-06-23T16:02:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dieye\_Pape\_Doudou](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@Dieye\_Pape\_Doudou](https://forum.ansible.com/u/Dieye_Pape_Doudou)\
**Post date:** [June 23, 2020, 4:02pm UTC](https://forum.ansible.com/t/cannot-run-my-inventory-script-in-awx/33236/1 "2020-06-23T16:02:30Z")

</div>

Hello , I have an issue with the execution of my plabooks on AWX.  
I use the API glpi : [https://github.com/unistra/ansible-inventory-glpi](https://github.com/unistra/ansible-inventory-glpi) in order to connect that with AWX.

With the documentation its runs very well in my local server .

I decided to test them on AWX.  
I have an errror when i run the script in AWX.  
Can someone help me please to reslove this issue ?

the inventory script : glpi-api.py  
the playbook which returns the information : glpi-api.yml  
My error :

ERROR! A playbook must be a list of plays, got a \<class ‘ansible.parsing.yaml.objects.AnsibleMapping’\> instead

12

13  
The error appears to be in ‘/tmp/awx\_609\_892b858g/project/exemples/glpi-api.yml’: line 5, column 1, but may

14  
be elsewhere in the file depending on the exact syntax problem.

15

16  
The offending line appears to be:

17

18

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [June 23, 2020, 5:21pm UTC](https://forum.ansible.com/t/cannot-run-my-inventory-script-in-awx/33236/2 "2020-06-23T17:21:41Z")

</div>

Iirc awx does not run the inventory sync at run time. It does it in the inventory section like an import.

---

<div class="post-metadata">

**Author:** ![Dieye\_Pape\_Doudou](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@Dieye\_Pape\_Doudou](https://forum.ansible.com/u/Dieye_Pape_Doudou)\
**Post date:** [June 24, 2020, 11:28am UTC](https://forum.ansible.com/t/cannot-run-my-inventory-script-in-awx/33236/3 "2020-06-24T11:28:06Z")

</div>

thanks for your feedback, the sync was not done !  
My error :

2.599 INFO Updating inventory 3: inventory GTO

2  
3.116 DEBUG Using base command: python /usr/bin/ansible-inventory -i /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj --playbook-dir /tmp/awx\_597\_mkurx6t1 -vvvvv

3  
3.116 INFO Reading Ansible inventory source: /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj

4  
3.118 INFO Using VIRTUAL\_ENV: /var/lib/awx/venv/ansible

5  
3.118 INFO Using PATH: /var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

6  
3.118 INFO Using PYTHONPATH: /var/lib/awx/venv/ansible/lib/python3.6/site-packages:

7  
Traceback (most recent call last):

8  
File “/var/lib/awx/venv/awx/bin/awx-manage”, line 8, in

9  
sys.exit(manage())

10  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/ **init**.py”, line 152, in manage

11  
execute\_from\_command\_line(sys.argv)

12  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/ **init**.py”, line 381, in execute\_from\_command\_line

13  
utility.execute()

14  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/ **init**.py”, line 375, in execute

15  
self.fetch\_command(subcommand).run\_from\_argv(self.argv)

16  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/base.py”, line 323, in run\_from\_argv

17  
self.execute(\*args, \*\*cmd\_options)

18  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/base.py”, line 364, in execute

19  
output = self.handle(\*args, \*\*options)

20  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/management/commands/inventory\_import.py”, line 1157, in handle

21  
raise exc

22  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/management/commands/inventory\_import.py”, line 1047, in handle

23  
venv\_path=venv\_path, verbosity=self.verbosity).load()

24  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/management/commands/inventory\_import.py”, line 215, in load

25  
return self.command\_to\_json(base\_args + [‘–list’])

26  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/management/commands/inventory\_import.py”, line 198, in command\_to\_json

27  
self.method, proc.returncode, stdout, stderr))

28  
RuntimeError: ansible-inventory failed (rc=1) with stdout:

30  
stderr:

31  
ansible-inventory 2.9.3

32  
config file = /etc/ansible/ansible.cfg

33  
configured module search path = [‘/var/lib/awx/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]

34  
ansible python module location = /usr/lib/python3.6/site-packages/ansible

35  
executable location = /usr/bin/ansible-inventory

36  
python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]

37  
Using /etc/ansible/ansible.cfg as config file

38  
setting up inventory plugins

39  
host\_list declined parsing /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj as it did not pass its verify\_file() method

40  
auto declined parsing /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj as it did not pass its verify\_file() method

41  
toml declined parsing /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj as it did not pass its verify\_file() method

42  
[WARNING]: \* Failed to parse /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj with script

43  
plugin: Inventory script (/tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj) had an execution

44  
error: usage: tmpjcrdkdhj [-h] [–glpi-url GLPI\_URL]

45  
[–glpi-usertoken GLPI\_USERTOKEN] [–glpi-apptoken

46  
GLPI\_APPTOKEN] [–config-file GROUPS\_CONFIG\_PATH] (–list |

47  
–host HOST) tmpjcrdkdhj: error: the following arguments are required: --glpi-

48  
url, --glpi-usertoken, --glpi-apptoken

49

50  
File “/usr/lib/python3.6/site-packages/ansible/inventory/manager.py”, line 280, in parse\_source

51  
plugin.parse(self.\_inventory, self.\_loader, source, cache=cache)

52  
File “/usr/lib/python3.6/site-packages/ansible/plugins/inventory/script.py”, line 161, in parse

53  
raise AnsibleParserError(to\_native(e))

54

55  
[WARNING]: \* Failed to parse /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj with yaml

56  
plugin: Syntax Error while loading YAML. did not find expected \<document

57

> The error appears to be in ‘/tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj’: line 4,

58  
column 3, but may be elsewhere in the file depending on the exact syntax

59  
problem. The offending line appears to be: “”"Ansible dynamic inventory for

60  
GLPI REST API.“”" ^ here

61

62  
File “/usr/lib/python3.6/site-packages/ansible/inventory/manager.py”, line 280, in parse\_source

63  
plugin.parse(self.\_inventory, self.\_loader, source, cache=cache)

64  
File “/usr/lib/python3.6/site-packages/ansible/plugins/inventory/yaml.py”, line 105, in parse

65  
raise AnsibleParserError(e)

66

67  
[WARNING]: \* Failed to parse /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj with ini

68  
plugin: /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj:6: Expected key=value host variable

69  
assignment, got: os

70

71  
File “/usr/lib/python3.6/site-packages/ansible/inventory/manager.py”, line 280, in parse\_source

72  
plugin.parse(self.\_inventory, self.\_loader, source, cache=cache)

73  
File “/usr/lib/python3.6/site-packages/ansible/plugins/inventory/ini.py”, line 138, in parse

74  
raise AnsibleParserError(e)

75

76  
[WARNING]: Unable to parse /tmp/awx\_597\_mkurx6t1/tmpjcrdkdhj as an inventory

77  
source

78

79  
ERROR! No inventory was parsed, please check your configuration and options.
