# Error Inventory Script

**URL:** <https://forum.ansible.com/t/error-inventory-script/33675>\
**Category:** AWX Project\
**Created:** [August 25, 2020, 7:05pm UTC](https://forum.ansible.com/t/error-inventory-script/33675 "2020-08-25T19:05:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zanoni\_Maciel](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@Zanoni\_Maciel](https://forum.ansible.com/u/Zanoni_Maciel)\
**Post date:** [August 25, 2020, 7:05pm UTC](https://forum.ansible.com/t/error-inventory-script/33675/1 "2020-08-25T19:05:53Z")

</div>

have a problem when trying to get the hosts of a nutanix cluster through a script. I’m taking the following error:

# ansible-inventory -i hosts --list

[WARNING]: \* Failed to parse /root/teste-nutanix/hosts with yaml plugin: Syntax Error while loading YAML. mapping values are not allowed in this context The error  
appears to be in ‘/root/teste-nutanix/hosts’: line 11, column 4, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to  
be: try: ^ here  
[WARNING]: \* Failed to parse /root/teste-nutanix/hosts with script plugin: failed to parse executable inventory script results from /root/teste-nutanix/hosts: Syntax  
Error while loading YAML. found unexpected ‘:’ The error appears to be in ‘’: line 1, column 36580, but may be elsewhere in the file depending on the exact  
syntax problem.  
[WARNING]: \* Failed to parse /root/teste-nutanix/hosts with ini plugin: /root/teste-nutanix/hosts:3: Expected key=value host variable assignment, got: os  
[WARNING]: Unable to parse /root/teste-nutanix/hosts as an inventory source  
ERROR! No inventory was parsed, please check your configuration and options.

This error occurs only on a single nutanix cluster. In two others I can get the data successfully.

Link Script File: ([https://github.com/mattkeeler/ansible-nutanix-inventory](https://github.com/mattkeeler/ansible-nutanix-inventory))

NOTE: I renamed the nutanix.py file for hosts and gave it permission to run on it.

---

<div class="post-metadata">

**Author:** ![Zanoni\_Maciel](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@Zanoni\_Maciel](https://forum.ansible.com/u/Zanoni_Maciel)\
**Post date:** [August 25, 2020, 7:07pm UTC](https://forum.ansible.com/t/error-inventory-script/33675/2 "2020-08-25T19:07:50Z")

</div>

When I run the script manually:

python3 hosts --list

I can get the results normally, but when I run the script via awx the error occurs.

So I’m testing with the ansible-inventory command

---

<div class="post-metadata">

**Author:** ![Zanoni\_Maciel](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@Zanoni\_Maciel](https://forum.ansible.com/u/Zanoni_Maciel)\
**Post date:** [August 26, 2020, 1:26am UTC](https://forum.ansible.com/t/error-inventory-script/33675/3 "2020-08-26T01:26:40Z")

</div>

I managed to solve the problem.

The script generates an error JSON result.

By editing the script so that the --pretty option is the default, the problem has been solved.
