ansible-plugin
ansible-plugin copied to clipboard
group_vars not loaded
Hello,
I'm not sure if this is related to our config but when the playbook is ran manually using ansible-playbook
the group_vars are loaded fine but when the same playbook is launched from rundeck they are not loaded properly. Our ansible path is already under /etc/ansible
. Should this work ? Is there a way to make it work without a having to copy all the variables in the rundeck job ?
Here's our structure:
/etc/ansible/inventories/production/hosts
/etc/ansible/inventories/production/group_vars/*
Thanks
I'd suggest making sure you have an ansible.cfg file at /etc/ansible with your inventory details configured. I'd also suggest making sure you use the Ansible base directory path option, setting it to /etc/ansible.
I'd suggest making sure you have an ansible.cfg file at /etc/ansible with your inventory details configured. I'd also suggest making sure you use the Ansible base directory path option, setting it to /etc/ansible.
Thanks for the recommendation. Unfortunately, I have already set everything mentioned in your post correctly to no avail.
I have a similar issue and it seems that rundeck is passing --limit argument to ansible-playbook whats ignore the inventory and group_vars. It is possible to check Ignore limit option in job settings but it doesn't resolve the issue in every case
@linlinas @camaer Can you run in debug mode and paste the logs? @linlinas Have you also followed the recommendations above about the Ansible base directory path?
I think the issue is that group_vars are loaded relative to your inventory. However it seems its not picking up the inventory location in project.ansible-inventory but instead using a file in /tmp. Since the group vars aren't in /tmp/group_vars you don't get inventory
1: Workflow step executing: StepExecutionItem{type='com.batix.rundeck.plugins.AnsiblePlaybookWorkflowStep', keepgoingOnSuccess=false, hasFailureHandler=false}
procArgs: [ansible-playbook, plays/operations/catalyst/get-catalyst-enabled-companies.yml, --inventory-file=/tmp/ansible-inventory8067836361491163995.json, -vvv, --vault-password-file=/tmp/ansible-runner1499314992005221382vault, -vvvvvv]
Well whatever is going on, the above is not the full story, as I rsync'ed my group_vars into /tmp but it still fails in the same way.
Is there a way to make it use my actual (ini format) inventory, rather than generating a json inventory?
Well to answer my own question, there is... Since ansible allows multiple sources of inventory, you can just add -i /path/to/your/actual/inventory and magically your group_vars are loaded.