azure icon indicating copy to clipboard operation
azure copied to clipboard

Azure inventory traceback when NIC isn't fully provisioned

Open p3ck opened this issue 9 months ago • 0 comments

SUMMARY

It's possible that a NIC hasn't fully come up for a VM when querying with the inventory plugin. If that happens you will get the following traceback when trying to access properties.

[WARNING]:  * Failed to parse /runner/inventory/azure_rm.yml with auto plugin:
'properties'
  File "/usr/lib/python3.9/site-packages/ansible/inventory/manager.py", line 293, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/lib/python3.9/site-packages/ansible/plugins/inventory/auto.py", line 59, in parse
    plugin.parse(inventory, loader, path, cache=cache)
  File "/usr/share/ansible/collections/ansible_collections/azure/azcollection/plugins/inventory/azure_rm.py", line 233, in parse
    self._get_hosts()
  File "/usr/share/ansible/collections/ansible_collections/azure/azcollection/plugins/inventory/azure_rm.py", line 326, in _get_hosts
    if self._filter_exclude_host(inventory_hostname, h.hostvars):
  File "/usr/share/ansible/collections/ansible_collections/azure/azcollection/plugins/inventory/azure_rm.py", line 605, in hostvars
    for ipc in sorted(nic._nic_model['properties']['ipConfigurations'], key=lambda i: i['properties'].get('primary', False), reverse=True):
[WARNING]: Unable to parse /runner/inventory/azure_rm.yml as an inventory
source
ERROR! No inventory was parsed, please check your configuration and options.
ISSUE TYPE
  • Bug Report
COMPONENT NAME

inventory/azure_rm.py

ANSIBLE VERSION
ansible [core 2.15.9]
  config file = /root/.ansible/collections/ansible_collections/azure/azcollection/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/venv-3.9/lib64/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/venv-3.9/bin/ansible
  python version = 3.9.18 (main, Sep 22 2023, 17:58:34) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/root/venv-3.9/bin/python3.9)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
# /root/venv-3.9/lib64/python3.9/site-packages/ansible_collections
Collection         Version
------------------ -------
azure.azcollection 2.3.0
CONFIGURATION
CONFIG_FILE() = /root/.ansible/collections/ansible_collections/azure/azcollection/ansible.cfg
DEFAULT_LOG_PATH(/root/.ansible/collections/ansible_collections/azure/azcollection/ansible.cfg) = /root/.ansible/colle>
OS / ENVIRONMENT

RHEL8.9

STEPS TO REPRODUCE

This is difficult to reproduce, It could be related to the number of VM's

p3ck avatar May 01 '24 19:05 p3ck