diff --git a/plugins/modules/azure_rm_virtualmachine_info.py b/plugins/modules/azure_rm_virtualmachine_info.py index 034b922a7..9d9a7406c 100644 --- a/plugins/modules/azure_rm_virtualmachine_info.py +++ b/plugins/modules/azure_rm_virtualmachine_info.py @@ -245,6 +245,18 @@ returned: always type: str sample: running + display_status: + description: + - The short localizable label for the status. + returned: always + type: str + sample: "VM running" + provisioning_state: + description: + - The provisioning state, which only appears in the response. + returned: always + type: str + sample: running ''' try: @@ -380,12 +392,16 @@ def serialize_vm(self, vm): code = instance['statuses'][index]['code'].split('/') if code[0] == 'PowerState': power_state = code[1] + display_status = instance['statuses'][index]['displayStatus'] elif code[0] == 'OSState' and code[1] == 'generalized': + display_status = instance['statuses'][index]['displayStatus'] power_state = 'generalized' break new_result = {} new_result['power_state'] = power_state + new_result['display_status'] = display_status + new_result['provisioning_state'] = vm.provisioning_state new_result['id'] = vm.id new_result['resource_group'] = resource_group new_result['name'] = vm.name diff --git a/tests/integration/targets/azure_rm_gallery/tasks/main.yml b/tests/integration/targets/azure_rm_gallery/tasks/main.yml index 676fcaa54..d70104563 100644 --- a/tests/integration/targets/azure_rm_gallery/tasks/main.yml +++ b/tests/integration/targets/azure_rm_gallery/tasks/main.yml @@ -50,9 +50,12 @@ - name: Get VM facts azure_rm_virtualmachine_info: resource_group: "{{ resource_group }}" - name: "vmforimage{{ rpfx }}" + name: "vmforimage{{ rpfx }}" register: output +- name: Pause for 10 mimutes to VM updating + shell: sleep 600 + - name: Create a snapshot by importing an unmanaged blob from the same subscription. azure_rm_snapshot: resource_group: "{{ resource_group }}" diff --git a/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_deallocate.yml b/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_deallocate.yml index be1e8839e..28c368026 100644 --- a/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_deallocate.yml +++ b/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_deallocate.yml @@ -18,6 +18,15 @@ version: latest register: vm_output +- name: Get VM facts + azure_rm_virtualmachine_info: + resource_group: "{{ resource_group }}" + name: "{{ vm_name }}" + register: vm_state + +- name: Pause for 10 mimutes to VM updating + shell: sleep 600 + - name: Restart the virtual machine azure_rm_virtualmachine: resource_group: "{{ resource_group }}" diff --git a/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_dual_nic.yml b/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_dual_nic.yml index 7bc07d492..e43b9a4bb 100644 --- a/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_dual_nic.yml +++ b/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_dual_nic.yml @@ -111,6 +111,15 @@ assert: that: dual_nics_result is not changed +- name: Get VM facts + azure_rm_virtualmachine_info: + resource_group: "{{ resource_group }}" + name: "{{ vm_name }}" + register: vm_state + +- name: Pause for 10 mimutes to VM updating + shell: sleep 600 + - name: Generalize VM azure_rm_virtualmachine: resource_group: "{{ resource_group }}" # Should this be resource_group_secondary? diff --git a/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_ephemeral_os.yml b/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_ephemeral_os.yml index 884a33db2..be705e164 100644 --- a/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_ephemeral_os.yml +++ b/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_ephemeral_os.yml @@ -17,6 +17,15 @@ version: latest register: vm_output +- name: Get VM facts + azure_rm_virtualmachine_info: + resource_group: "{{ resource_group }}" + name: "{{ vm_name }}" + register: vm_state + +- name: Pause for 10 mimutes to VM updating + shell: sleep 600 + - name: Generalize VM azure_rm_virtualmachine: resource_group: "{{ resource_group }}" diff --git a/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_public_ip.yml b/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_public_ip.yml index b71389453..0894023ae 100644 --- a/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_public_ip.yml +++ b/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_public_ip.yml @@ -85,6 +85,15 @@ - not vm_facts_no_boot_diag_result.vms[0].boot_diagnostics.enabled - not vm_facts_no_boot_diag_result.vms[0].boot_diagnostics.storage_uri +- name: Get VM facts + azure_rm_virtualmachine_info: + resource_group: "{{ resource_group }}" + name: "{{ vm_name }}" + register: vm_state + +- name: Pause for 10 mimutes to VM updating + shell: sleep 600 + - name: Enable boot diagnostics on an existing VM for the first time without specifying a storage account azure_rm_virtualmachine: resource_group: "{{ resource_group }}" diff --git a/tests/integration/targets/azure_rm_virtualmachinescaleset/tasks/main.yml b/tests/integration/targets/azure_rm_virtualmachinescaleset/tasks/main.yml index 1c0ad5e1d..9677b75f9 100644 --- a/tests/integration/targets/azure_rm_virtualmachinescaleset/tasks/main.yml +++ b/tests/integration/targets/azure_rm_virtualmachinescaleset/tasks/main.yml @@ -73,6 +73,13 @@ publisher: Canonical sku: 18.04-LTS version: latest +- name: Get VM facts + azure_rm_virtualmachine_info: + resource_group: "{{ resource_group }}" + name: "vmforimage{{ rpfx }}" + register: vm_state +- name: Pause for 10 mimutes to VM updating + shell: sleep 600 - name: Generalize VM azure_rm_virtualmachine: resource_group: "{{ resource_group }}" diff --git a/tests/integration/targets/inventory_azure/playbooks/setup.yml b/tests/integration/targets/inventory_azure/playbooks/setup.yml index e00e4bb9f..a8358089f 100644 --- a/tests/integration/targets/inventory_azure/playbooks/setup.yml +++ b/tests/integration/targets/inventory_azure/playbooks/setup.yml @@ -45,4 +45,4 @@ publisher: Canonical sku: 16.04-LTS version: latest - register: vm_output \ No newline at end of file + register: vm_output diff --git a/tests/integration/targets/inventory_azure/playbooks/test_inventory.yml b/tests/integration/targets/inventory_azure/playbooks/test_inventory.yml index 57bef334f..fd39a273c 100644 --- a/tests/integration/targets/inventory_azure/playbooks/test_inventory.yml +++ b/tests/integration/targets/inventory_azure/playbooks/test_inventory.yml @@ -5,6 +5,9 @@ tasks: - include_vars: vars.yml + - name: Pause for 10 mimutes for updating + shell: sleep 600 + - meta: refresh_inventory - name: Test Inventory