Dynamic Ansible inventory for Orka clusters
- Log in to the Orka CLI
- Clone the repo
- Test the script by running:
python3 orka_inventory.py --listIt should print JSON output representing your current Orka inventory. - Make the file executable by running:
chmod +x orka_inventory.py - Set the environment variables
ANSIBLE_SSH_USERandANSIBLE_SSH_PASS - Test the dynamic inventory by running:
sudo ansible all -i orka_inventory.py -m ping
Optional arguments to be passed as environment variables:
ANSIBLE_NAME_CONTAINS: a string by which to filter running VMs.
Example usage:
export ANSIBLE_NAME_CONTAINS=prod
Only running VMs with prod in the VM name will be added to the inventory.
If the file appears to run, but produces no output check that python3 exists at /usr/bin/.