Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add creation timestamp to hostvars #1221

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugins/inventory/azure_rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# 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'
# creation_time: datetime object of when the VM was created, eg '2023-07-21T09:30:30.4710164+00:00'
#
# 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.
Expand Down Expand Up @@ -180,7 +181,7 @@ def __init__(self):
self._filters = None

# FUTURE: use API profiles with defaults
self._compute_api_version = '2017-03-30'
self._compute_api_version = '2021-11-01'
self._network_api_version = '2015-06-15'

self._default_header_parameters = {'Content-Type': 'application/json; charset=utf-8'}
Expand Down Expand Up @@ -558,6 +559,7 @@ def hostvars(self):
plan=self._vm_model['properties']['plan']['name'] if self._vm_model['properties'].get('plan') else None,
resource_group=parse_resource_id(self._vm_model['id']).get('resource_group').lower(),
default_inventory_hostname=self.default_inventory_hostname,
creation_time=self._vm_model['properties']['timeCreated'],
)

# set nic-related values from the primary NIC first
Expand Down