rundeck-plugins / ansible-plugin

Ansible Integration for Rundeck
MIT License
330 stars 100 forks source link

JSON inventory has invalid structure, it should contain an "inventory" key #301

Closed rooso closed 3 years ago

rooso commented 3 years ago

Hi there! I'm working on using my Ansible inventory in Rundeck.

I'm able to import the inventory to Rundeck. All Nodes are showing up. When I try to run a command on a Node, I got an Ansible Inventory error.

Environment

Error from Ansible:

[WARNING]:  * Failed to parse /tmp/rundeck/ansible-inventory6463188845120896935.json with json plugin: JSON inventory has invalid structure, it should contain an "inventory" key.
[WARNING]: Unable to parse /tmp/rundeck/ansible-inventory6463188845120896935.json as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: CENSORED

project.properties

nodes.plugin.1.config.add=username\=root\nssh-key-storage-path\=key/rundeck
nodes.plugin.1.config.match=distribution\=\=CentOS
nodes.plugin.1.type=attributeMatch
project.ansible-config-file-path=/git/ansible/ansible.cfg
project.ansible-executable=/bin/bash
project.ansible-generate-inventory=true
project.ansible-ssh-passphrase-option=option.password
project.ansible-vault-path=/git/ansible/environments/CENSORED/inventory/group_vars/all/vault.yml
project.ansible-vault-storage-path=CENSORED
project.description=
project.disable.executions=false
project.disable.schedule=false
project.execution.history.cleanup.batch=500
project.execution.history.cleanup.enabled=false
project.execution.history.cleanup.retention.days=60
project.execution.history.cleanup.retention.minimum=50
project.execution.history.cleanup.schedule=0 0 0 1/1 * ? *
project.jobs.gui.groupExpandLevel=1
project.label=
project.name=Inventory-Test-Neu
project.nodeCache.enabled=true
project.nodeCache.firstLoadSynch=true
project.output.allowUnsanitized=false
project.ssh-authentication=privateKey
project.ssh-keypath=CENSORED
resources.source.1.type=local
resources.source.2.config.ansible-config-file-path=/git/ansible/ansible.cfg
resources.source.2.config.ansible-gather-facts=false
resources.source.2.config.ansible-ignore-errors=true
resources.source.2.type=com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory
service.FileCopier.default.provider=jsch-scp
service.NodeExecutor.default.provider=com.batix.rundeck.plugins.AnsibleNodeExecutor

Steps taken

Does anybody might have a tip, how to resolve this issue? What is also not clear to me, is the fact Rundeck is locking for /tmp/rundeck/ansible-inventory6463188845120896935.json and not my defined json in the config?

Thank you! Oliver

rooso commented 3 years ago

Found it! :) I had enabled the option Generate inventory in Default Node Exectuor. Without checking this box, it works as expected.