I am trying to set up a dynamic inventory for Ansible to use with Azure, but I am getting some messages as Ansible is not able to parse my yaml file.
What I did so far:
Created Azure Service Principal and added credentials to /home/user/.azure/credentials (I know they recommend placing them in /home/.azure/credentials and I tried that, but it seems that my Ansible looks for them in the /home/user directory.
I placed both the python plugin (the original, unedited plugin) and its yaml config file in /etc/ansible/inventory_plugins. The config file looks like this:
plugin: azure_rm
include_vm_resource_groups:
- vm_1197_rg
auth_source: auto
- Testing the functionality with: ansible all -m ping -i ./myazure_rm.yml
The output:
ansible 2.8.1 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible python version = 2.7.5 (default, Apr 9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] Using /etc/ansible/ansible.cfg as config file Skipping due to inventory source not existing or not being readable by the current user azure_rm declined parsing /etc/ansible/inventory_plugins/myazure_rm.yml as it did not pass it's verify_file() method [WARNING]: Unable to parse /etc/ansible/inventory_plugins/myazure_rm.yml 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'
It seems that I was using the wrong extension when running the command. I was using .yml instead of using .yaml like the file is actually called.