forked from ansible-collections/community.vmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport PR ansible-collections#1337 to stable-1
- Loading branch information
Showing
3 changed files
with
99 additions
and
40 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
changelogs/fragments/1337_vmware_host_vmnic_info-fix_disconnected.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- vmware_host_vmnic_info - Fix a bug that crashes the module when a host is disconnected (https://github.com/ansible-collections/community.vmware/pull/1337). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,39 +2,93 @@ | |
# Copyright: (c) 2018, Abhijeet Kasurde <[email protected]> | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
# TODO: vcsim does not support networkConfig related to operations | ||
- when: vcsim is not defined | ||
- import_role: | ||
name: prepare_vmware_tests | ||
vars: | ||
setup_attach_host: true | ||
|
||
- name: Gather vmnic info about a host | ||
vmware_host_vmnic_info: | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
esxi_hostname: '{{ esxi1 }}' | ||
validate_certs: false | ||
register: host_vmnics | ||
- debug: var=host_vmnics | ||
- assert: | ||
that: | ||
- host_vmnics.hosts_vmnics_info is defined | ||
|
||
- name: Gather extended vmnic info about a host | ||
vmware_host_vmnic_info: | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
esxi_hostname: '{{ esxi1 }}' | ||
validate_certs: false | ||
capabilities: true | ||
directpath_io: true | ||
sriov: true | ||
register: host_vmnics_extended | ||
- debug: var=host_vmnics_extended | ||
- assert: | ||
that: | ||
- host_vmnics_extended.hosts_vmnics_info is defined | ||
|
||
- name: Get info from an ESXi host that is offline / disconnected / shut down | ||
block: | ||
- import_role: | ||
name: prepare_vmware_tests | ||
vars: | ||
setup_attach_host: true | ||
- name: Disconnect ESXi host | ||
community.vmware.vmware_host: | ||
validate_certs: false | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
datacenter_name: '{{ dc1 }}' | ||
cluster_name: '{{ ccr1 }}' | ||
esxi_hostname: "{{ esxi1 }}" | ||
state: disconnected | ||
|
||
- name: Give the ESXi host time to disconnect | ||
ansible.builtin.pause: | ||
minutes: 1 | ||
|
||
- name: Gather vmnic info about a host | ||
vmware_host_vmnic_info: | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
esxi_hostname: '{{ esxi1 }}' | ||
validate_certs: false | ||
register: host_vmnics | ||
- debug: var=host_vmnics | ||
- assert: | ||
that: | ||
- host_vmnics.hosts_vmnics_info is defined | ||
- name: Gather vmnic info about a host that is offline / disconnected / shut down | ||
vmware_host_vmnic_info: | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
esxi_hostname: '{{ esxi1 }}' | ||
validate_certs: false | ||
register: host_vmnics_disconnected | ||
- debug: var=host_vmnics_disconnected | ||
- assert: | ||
that: | ||
- host_vmnics_disconnected.hosts_vmnics_info is defined | ||
|
||
- name: Gather extended vmnic info about a host | ||
vmware_host_vmnic_info: | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
esxi_hostname: '{{ esxi1 }}' | ||
validate_certs: false | ||
capabilities: true | ||
directpath_io: true | ||
sriov: true | ||
register: host_vmnics_extended | ||
- debug: var=host_vmnics_extended | ||
- assert: | ||
that: | ||
- host_vmnics_extended.hosts_vmnics_info is defined | ||
- name: Gather extended vmnic info about a host that is offline / disconnected / shut down | ||
vmware_host_vmnic_info: | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
esxi_hostname: '{{ esxi1 }}' | ||
validate_certs: false | ||
capabilities: true | ||
directpath_io: true | ||
sriov: true | ||
register: host_vmnics_extended_disconnected | ||
- debug: var=host_vmnics_extended_disconnected | ||
- assert: | ||
that: | ||
- host_vmnics_extended_disconnected.hosts_vmnics_info is defined | ||
always: | ||
- name: Reconnect ESXi host | ||
community.vmware.vmware_host: | ||
validate_certs: false | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
datacenter_name: '{{ dc1 }}' | ||
cluster_name: '{{ ccr1 }}' | ||
esxi_hostname: "{{ esxi1 }}" | ||
state: reconnect |