Hi Guys,
I am trying to play around with Ansible dynamic inventory to get software installed/perform configuration management.
I have executed instructions as given by Microsoft here: https://docs.microsoft.com/en-us/azure/ansible/ansible-manage-azure-dynamic-inventories
Commands from my VM are here:
az group create --resource-group ansible-inventory-test-rg --location eastus
az vm create --resource-group ansible-inventory-test-rg --name ansible-inventory-test-vm1 --image UbuntuLTS --generate-ssh-keys
az vm create --resource-group ansible-inventory-test-rg --name ansible-inventory-test-vm2 --image UbuntuLTS --generate-ssh-keys
az account show
az resource tag --tags nginx --id /subscriptions//resourceGroups/ansible-inventory-test-rg/providers/Microsoft.Compute/virtualMachines/ansible-inventory-test-vm1
wget https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/azure_rm.py
chmod +x azure_rm.py
ansible -i azure_rm.py ansible-inventory-test-rg -m ping
However, it errors out as below:
[WARNING]: * Failed to parse /media/sf_C_DRIVE/OnlyOnMyPC/ansible.rhel75.master/azure_rm.py with script plugin: Inventory script
(/media/sf_C_DRIVE/OnlyOnMyPC/ansible.rhel75.master/azure_rm.py) had an execution error: /usr/lib/python2.7/site-packages/requests/init.py:91:
RequestsDependencyWarning: urllib3 (1.24.1) or chardet (2.2.1) doesn’t match a supported version! RequestsDependencyWarning) ‘Cloud’ object has no attribute ‘find’
[WARNING]: * Failed to parse /media/sf_C_DRIVE/OnlyOnMyPC/ansible.rhel75.master/azure_rm.py with ini plugin:
/media/sf_C_DRIVE/OnlyOnMyPC/ansible.rhel75.master/azure_rm.py:22: Error parsing host definition ‘’‘’': No closing quotation
[WARNING]: Unable to parse /media/sf_C_DRIVE/OnlyOnMyPC/ansible.rhel75.master/azure_rm.py 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: ansible-inventory-test-rg
I am unable to understand what is the missing link here as I have executed as it is documented from Microsoft site, am I missing here anything?
Also how that Python script would know which subscription, which resource group and which VM’s it has to apply a particular playbook?
Kind Regards,
Ameya Agashe