Error Inventory Dynamic Script

Latest response


I'm having trouble trying to get the hosts through a python script.

With the same script I am able to obtain data from two other hosts.

NOTE: The provider are nutanix clusters.

the script link is at:

The nutanix cluster in question is in the same version as the other two clusters.

When I run the script I get the following result:

[root @ srv-ansible-app-prd test-nutanix] # ansible-inventory -i --list
[WARNING]: * Failed to parse /root/test-nutanix/ with script plugin: failed to parse executable inventory script results from / root / test-
nutanix / Syntax Error while loading YAML. found unexpected ':' The error appears to be in '': line 1, column 36617, but may be elsewhere in the
file depending on the exact syntax problem.
[WARNING]: * Failed to parse /root/test-nutanix/ with ini plugin: /root/test-nutanix/ Expected key = value host variable assignment, got: os
[WARNING]: Unable to parse /root/test-nutanix/ as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
"_goal": {
"hostvars": {}
"all": {
"children": [

attached I am putting the result of the script with the two hosts that I have not reported the error


[root@srv-ansible-app-prd inventory-nutanix]# ansible-inventory -i hosts --list
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this will change, but still be user
configurable on deprecation. This feature will be removed in version 2.10. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
    "_meta": {
        "hostvars": {
            "debian test": {
                "acropolisVm": true,
                "clusterUuid": "0005874a-cfbc-da86-0000-000000027d23",
                "consistencyGroupName": "Debian Test",
                "containerIds": [
                "containerUuids": [

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.