diff --git a/plugins/inventory/azure_rm.py b/plugins/inventory/azure_rm.py index cc7c7bf3d..d968954e8 100644 --- a/plugins/inventory/azure_rm.py +++ b/plugins/inventory/azure_rm.py @@ -35,6 +35,9 @@ # vmid: the VM's internal SMBIOS ID, eg: '36bca69d-c365-4584-8c06-a62f4a1dc5d2' # vmss: if the VM is a member of a scaleset (vmss), a dictionary including the id and name of the parent scaleset # availability_zone: availability zone in which VM is deployed, eg '1','2','3' +# +# The following host variables are sometimes availble: +# computer_name: the Operating System's hostname. Will not be available if azure agent is not available and picking it up. # sample 'myazuresub.azure_rm.yaml' @@ -513,6 +516,7 @@ def hostvars(self): id=self._vm_model['id'], location=self._vm_model['location'], name=self._vm_model['name'], + computer_name=self._vm_model['properties']['osProfile'].get('computerName'), availability_zone=av_zone, powerstate=self._powerstate, provisioning_state=self._vm_model['properties']['provisioningState'].lower(),