diff options
author | pratikgadiya12 <pratikgadiya12@users.noreply.github.com> | 2019-08-27 00:15:34 +0530 |
---|---|---|
committer | Gonéri Le Bouder <goneri@lebouder.net> | 2019-08-26 14:45:34 -0400 |
commit | 8ee7d9f5981744a3c8d04cd58849a1bc49d96016 (patch) | |
tree | 294ed2789a21606ad47bb30cbfcde89598361b16 /test | |
parent | 47c2ff4c26c93578f4a7f1581624852592a7c31c (diff) | |
download | ansible-8ee7d9f5981744a3c8d04cd58849a1bc49d96016.tar.gz |
VMWare - Rename _facts to _info (#57474)
Deprecate vmware's _facts modules and add new modules.
Fixes: #57278
Diffstat (limited to 'test')
76 files changed, 1967 insertions, 121 deletions
diff --git a/test/integration/targets/prepare_vmware_tests/tasks/setup_datastore.yml b/test/integration/targets/prepare_vmware_tests/tasks/setup_datastore.yml index 3b1ae01f9e..ee0957579b 100644 --- a/test/integration/targets/prepare_vmware_tests/tasks/setup_datastore.yml +++ b/test/integration/targets/prepare_vmware_tests/tasks/setup_datastore.yml @@ -28,14 +28,14 @@ with_items: "{{ esxi_hosts }}" - name: The vcenter needs a bit of time to refresh the DS list - vmware_datastore_facts: + vmware_datastore_info: validate_certs: false hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' cluster: '{{ ccr1 }}' - register: setup_datastore_datatstore_facts - failed_when: setup_datastore_datatstore_facts.datastores|selectattr('type', 'equalto', 'NFS')|list|length != 2 - until: setup_datastore_datatstore_facts is succeeded + register: setup_datastore_datatstore_info + failed_when: setup_datastore_datatstore_info.datastores|selectattr('type', 'equalto', 'NFS')|list|length != 2 + until: setup_datastore_datatstore_info is succeeded retries: 60 delay: 1 diff --git a/test/integration/targets/prepare_vmware_tests/tasks/setup_tag.yml b/test/integration/targets/prepare_vmware_tests/tasks/setup_tag.yml index 2ea2c62319..9719454e52 100644 --- a/test/integration/targets/prepare_vmware_tests/tasks/setup_tag.yml +++ b/test/integration/targets/prepare_vmware_tests/tasks/setup_tag.yml @@ -1,5 +1,5 @@ - name: Get Category facts - vmware_category_facts: + vmware_category_info: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' @@ -10,7 +10,7 @@ set_fact: cluster_category_id: "{{ item.category_id }}" with_items: - - "{{ cat_info.tag_category_facts | json_query(query) }}" + - "{{ cat_info.tag_category_info | json_query(query) }}" vars: query: "[?category_name=='{{ cluster_category }}']" diff --git a/test/integration/targets/vmware_about_info/aliases b/test/integration/targets/vmware_about_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_about_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_about_info/tasks/main.yml b/test/integration/targets/vmware_about_info/tasks/main.yml new file mode 100644 index 0000000000..a46c55edb4 --- /dev/null +++ b/test/integration/targets/vmware_about_info/tasks/main.yml @@ -0,0 +1,58 @@ +# Test code for the vmware_about_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + +- name: Get Details about VMware vCenter Server + vmware_about_info: &vmware_about_data + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + register: about + +- assert: + that: + - about.about_info["{{ item }}"] is defined + with_items: + - api_type + - api_version + - build + - instance_uuid + - license_product_name + - license_product_version + - locale_build + - locale_version + - os_type + - product_full_name + - product_line_id + - product_name + - vendor + - version + +- name: Get Details about VMware vCenter Server in check mode + vmware_about_info: + <<: *vmware_about_data + register: about + check_mode: yes + +- assert: + that: + - about.about_info["{{ item }}"] is defined + with_items: + - api_type + - api_version + - build + - instance_uuid + - license_product_name + - license_product_version + - locale_build + - locale_version + - os_type + - product_full_name + - product_line_id + - product_name + - vendor + - version diff --git a/test/integration/targets/vmware_cluster_info/aliases b/test/integration/targets/vmware_cluster_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_cluster_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_cluster_info/tasks/main.yml b/test/integration/targets/vmware_cluster_info/tasks/main.yml new file mode 100644 index 0000000000..0d0ba4e947 --- /dev/null +++ b/test/integration/targets/vmware_cluster_info/tasks/main.yml @@ -0,0 +1,91 @@ +# Test code for the vmware_cluster_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + +- &vc_all_data + name: gather info about all clusters in the given datacenter + vmware_cluster_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: False + datacenter: "{{ dc1 }}" + register: all_cluster_result + +- &ensure_vc_all_data + name: ensure info are gathered for all clusters + assert: + that: + - all_cluster_result.clusters + - not all_cluster_result.changed + +- <<: *vc_all_data + name: Gather info about all clusters in the given datacenter in check mode + check_mode: yes + +- debug: msg=all_cluster_result + +- <<: *ensure_vc_all_data + name: Ensure info is gathered for all clusters in check mode + +- &vc_cluster_data + name: Gather info about the given cluster + vmware_cluster_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: False + cluster_name: "{{ ccr1 }}" + register: cluster_result + +- &ensure_vc_cluster_data + name: Ensure info are gathered for the given cluster + assert: + that: + - cluster_result.clusters + - not cluster_result.changed + +- <<: *vc_cluster_data + name: Gather info about the given cluster in check mode + check_mode: yes + +- <<: *ensure_vc_cluster_data + name: Ensure info is gathered for the given cluster in check mode + +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_category: true + setup_tag: true + + - name: Apply tag to cluster + vmware_tag_manager: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + tag_names: + - '{{ cluster_category }}:{{ cluster_tag }}' + state: present + object_name: '{{ ccr1 }}' + object_type: ClusterComputeResource + + - name: Get info about cluster + vmware_cluster_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + show_tag: True + cluster_name: "{{ ccr1 }}" + register: cluster_info + + - assert: + that: + - cluster_info is defined + - cluster_info.clusters[ccr1].tags is defined diff --git a/test/integration/targets/vmware_content_library_info/tasks/main.yml b/test/integration/targets/vmware_content_library_info/tasks/main.yml index bfbdd416cf..d9d22b9812 100644 --- a/test/integration/targets/vmware_content_library_info/tasks/main.yml +++ b/test/integration/targets/vmware_content_library_info/tasks/main.yml @@ -32,9 +32,9 @@ password: '{{ vcenter_password }}' library_id: '{{ content_library }}' validate_certs: false - register: content_lib_facts + register: content_lib_info - name: Check Content Library details assert: that: - - '{{ content_lib_facts.content_lib_details[0].library_id == content_library }}' + - '{{ content_lib_info.content_lib_details[0].library_id == content_library }}' diff --git a/test/integration/targets/vmware_datastore_info/aliases b/test/integration/targets/vmware_datastore_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_datastore_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_datastore_info/tasks/main.yml b/test/integration/targets/vmware_datastore_info/tasks/main.yml new file mode 100644 index 0000000000..1861ccc115 --- /dev/null +++ b/test/integration/targets/vmware_datastore_info/tasks/main.yml @@ -0,0 +1,126 @@ +# Test code for the vmware_datastore_info module. +# Copyright (c) 2017, Tim Rightnour <thegarbledone@gmail.com> +# Copyright (c) 2018, Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + + +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + setup_datastore: true + +- when: vcsim is not defined + block: + - name: get list of info about datastores from the ESXi + vmware_datastore_info: + validate_certs: False + hostname: '{{ item }}' + username: '{{ esxi_user }}' + password: '{{ esxi_password }}' + register: info_from_esxi + with_items: "{{ esxi_hosts }}" + - assert: + that: + - "info_from_esxi.results[0].datastores|selectattr('type', 'equalto', 'NFS')|list|length == 2" + +- name: get list of info about datastores + vmware_datastore_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + gather_nfs_mount_info: true + register: info_from_vcenter_with_dc_filter + +- when: vcsim is not defined + block: + - name: get list of info about datastores + vmware_datastore_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + gather_nfs_mount_info: true + register: info_from_vcenter_with_no_filter + + - assert: + that: + - "info_from_vcenter_with_dc_filter.datastores|selectattr('type', 'equalto', 'NFS')|list|length == 2" + - "info_from_vcenter_with_no_filter.datastores|selectattr('type', 'equalto', 'NFS')|list|length == 2" + - "info_from_vcenter_with_no_filter.datastores[0]['capacity'] is defined" + +# Testcase 0002: Get a full list of datastores in a cluster +- name: get list of info about datastores - no dc + vmware_datastore_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster: "{{ ccr1 }}" + register: datastore_info_0002 + +- debug: + msg: "{{ datastore_info_0002 }}" + +- assert: + that: + - "datastore_info_0002['datastores'][0]['capacity'] is defined" + +# Testcase 0003: Find a specific datastore +- name: get list of info about one datastore + vmware_datastore_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + name: "{{ ds1 }}" + register: datastore_info_0003 + +- debug: + msg: "{{ datastore_info_0003 }}" + +- assert: + that: + - "datastore_info_0003['datastores'][0]['name'] == ds1" + - "datastore_info_0003['datastores'][0]['capacity'] is defined" + +- name: get list of extended info about one datastore + vmware_datastore_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + name: "{{ ds1 | basename }}" + gather_nfs_mount_info: True + gather_vmfs_mount_info: True + register: datastore_info_0004 + +- debug: + msg: "{{ datastore_info_0004 }}" + +- assert: + that: + - "datastore_info_0004['datastores'][0]['name'] == ds1" + - "datastore_info_0004['datastores'][0]['capacity'] is defined" + +- name: get list of info about one datastore in check mode + vmware_datastore_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + name: "{{ ds1 | basename }}" + register: datastore_info_0005 + +- debug: + msg: "{{ datastore_info_0005 }}" + +- assert: + that: + - "datastore_info_0005['datastores'][0]['name'] == ds1" + - "datastore_info_0005['datastores'][0]['capacity'] is defined" diff --git a/test/integration/targets/vmware_drs_group_info/aliases b/test/integration/targets/vmware_drs_group_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_drs_group_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_drs_group_info/tasks/main.yml b/test/integration/targets/vmware_drs_group_info/tasks/main.yml new file mode 100644 index 0000000000..8b7e20be64 --- /dev/null +++ b/test/integration/targets/vmware_drs_group_info/tasks/main.yml @@ -0,0 +1,44 @@ +# Test code for the vmware_drs_group_info module +# Copyright: (c) 2018, Karsten Kaj Jakobsen <kj@patientsky.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + +- when: vcsim is defined or esxi_hosts | length >= 3 + block: + - name: Gather DRS group info from given cluster + vmware_drs_group_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster_name: '{{ ccr1 }}' + validate_certs: False + register: drs_group_0001_results + + - debug: + var: drs_group_0001_results + + - assert: + that: + - "drs_group_0001_results.drs_group_info.DC0_C0 is defined" + - "not drs_group_0001_results.drs_group_info.DC0_C1 is defined" + - "not drs_group_0001_results.changed" + + - name: Gather DRS group info from given datacenter + vmware_drs_group_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: '{{ dc1 }}' + validate_certs: False + register: drs_group_0002_results + + - debug: + var: drs_group_0002_results + + - assert: + that: + - "drs_group_0002_results.drs_group_info.DC0_C0 is defined" + - "not drs_group_0002_results.drs_group_info.DC0_C1 is defined" + - "not drs_group_0002_results.changed" diff --git a/test/integration/targets/vmware_drs_rule_info/aliases b/test/integration/targets/vmware_drs_rule_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_drs_rule_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_drs_rule_info/tasks/main.yml b/test/integration/targets/vmware_drs_rule_info/tasks/main.yml new file mode 100644 index 0000000000..1b4f428d69 --- /dev/null +++ b/test/integration/targets/vmware_drs_rule_info/tasks/main.yml @@ -0,0 +1,47 @@ +# Test code for the vmware_drs_rule_info module +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + +- when: vcsim is defined or esxi_hosts | length >= 3 + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + - name: Gather info about DRS rule from given cluster + vmware_drs_rule_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster_name: DC0_C0 + register: drs_rule_0001_results + + - debug: + var: drs_rule_0001_results + + - assert: + that: + - "drs_rule_0001_results.drs_rule_info is defined" + - "not drs_rule_0001_results.changed" + + - name: Gather info about DRS rule from given datacenter + vmware_drs_rule_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: DC0 + register: drs_rule_0001_results + + - debug: + var: drs_rule_0001_results + + - assert: + that: + - "drs_rule_0001_results.drs_rule_info is defined" + - "not drs_rule_0001_results.changed" diff --git a/test/integration/targets/vmware_dvs_portgroup_info/aliases b/test/integration/targets/vmware_dvs_portgroup_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_dvs_portgroup_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_dvs_portgroup_info/tasks/main.yml b/test/integration/targets/vmware_dvs_portgroup_info/tasks/main.yml new file mode 100644 index 0000000000..52babceeca --- /dev/null +++ b/test/integration/targets/vmware_dvs_portgroup_info/tasks/main.yml @@ -0,0 +1,56 @@ +# Test code for the vmware_dvs_portgroup_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + vars: + setup_dvswitch: true + +- when: vcsim is not defined + block: + - &dvs_info + name: Gather info about DVS portgroup + vmware_dvs_portgroup_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + register: dvs_results + + - debug: + var: dvs_results + + - assert: + that: + - dvs_results.dvs_portgroup_info is defined + + - <<: *dvs_info + name: Gather info about DVS portgroup in check mode + check_mode: yes + + - debug: + var: dvs_results + + - assert: + that: + - dvs_results.dvs_portgroup_info is defined + +# Testcase 0002: Get portgroup info for a given dvswitch +- name: get info for a given dvswitch + vmware_dvs_portgroup_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + dvswitch: "{{ dvswitch1 }}" + register: dvs_results_0002 + +- debug: + msg: "{{ dvs_results_0002 }}" + +- assert: + that: + - "dvs_results_0002['dvs_portgroup_info']['DVS0'] is defined" diff --git a/test/integration/targets/vmware_guest_boot_info/aliases b/test/integration/targets/vmware_guest_boot_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_guest_boot_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_guest_boot_info/tasks/main.yml b/test/integration/targets/vmware_guest_boot_info/tasks/main.yml new file mode 100644 index 0000000000..f40f397181 --- /dev/null +++ b/test/integration/targets/vmware_guest_boot_info/tasks/main.yml @@ -0,0 +1,51 @@ +# Test code for the vmware_guest_boot_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + setup_datastore: true + setup_virtualmachines: true + + - name: Gather info about VM boot order + vmware_guest_boot_info: + validate_certs: no + hostname: '{{ vcenter_hostname }}' + username: '{{ vcenter_username }}' + password: '{{ vcenter_password }}' + name: "{{ virtual_machines[0].name }}" + register: vm1_info + - debug: var=vm1_info + - name: assert that values are set + assert: + that: + - vm1_info.vm_boot_info.current_boot_delay is defined + - vm1_info.vm_boot_info.current_boot_firmware is defined + - vm1_info.vm_boot_info.current_boot_order is defined + - vm1_info.vm_boot_info.current_boot_retry_delay is defined + - vm1_info.vm_boot_info.current_boot_retry_enabled is defined + - vm1_info.vm_boot_info.current_enter_bios_setup is defined + + - name: Gather info about VM boot order in check mode + vmware_guest_boot_info: + validate_certs: no + hostname: '{{ vcenter_hostname }}' + username: '{{ vcenter_username }}' + password: '{{ vcenter_password }}' + name: "{{ virtual_machines[0].name }}" + check_mode: yes + register: vm1_info + - debug: var=vm1_info + - name: assert that values are set + assert: + that: + - vm1_info.vm_boot_info.current_boot_delay is defined + - vm1_info.vm_boot_info.current_boot_firmware is defined + - vm1_info.vm_boot_info.current_boot_order is defined + - vm1_info.vm_boot_info.current_boot_retry_delay is defined + - vm1_info.vm_boot_info.current_boot_retry_enabled is defined + - vm1_info.vm_boot_info.current_enter_bios_setup is defined diff --git a/test/integration/targets/vmware_guest_custom_attributes/tasks/main.yml b/test/integration/targets/vmware_guest_custom_attributes/tasks/main.yml index de77fe718f..64b9f8963c 100644 --- a/test/integration/targets/vmware_guest_custom_attributes/tasks/main.yml +++ b/test/integration/targets/vmware_guest_custom_attributes/tasks/main.yml @@ -27,13 +27,13 @@ value: 'sample_2_value' - name: 'sample_3' value: 'sample_3_value' - register: guest_facts_0001 + register: guest_info_0001 -- debug: var=guest_facts_0001 +- debug: var=guest_info_0001 - assert: that: - - guest_facts_0001 is changed + - guest_info_0001 is changed - name: Add custom attribute to the given virtual machine again vmware_guest_custom_attributes: @@ -52,13 +52,13 @@ value: 'sample_2_value' - name: 'sample_3' value: 'sample_3_value' - register: guest_facts_0002 + register: guest_info_0002 -- debug: var=guest_facts_0002 +- debug: var=guest_info_0002 - assert: that: - - not (guest_facts_0002 is changed) + - not (guest_info_0002 is changed) - name: Remove custom attribute to the given virtual machine vmware_guest_custom_attributes: @@ -74,13 +74,13 @@ - name: 'sample_1' - name: 'sample_2' - name: 'sample_3' - register: guest_facts_0004 + register: guest_info_0004 -- debug: msg="{{ guest_facts_0004 }}" +- debug: msg="{{ guest_info_0004 }}" - assert: that: - - "guest_facts_0004.changed" + - "guest_info_0004.changed" # TODO: vcsim returns duplicate values so removing custom attributes # results in change. vCenter show correct behavior. Commenting this @@ -101,10 +101,10 @@ - name: 'sample_1' - name: 'sample_2' - name: 'sample_3' - register: guest_facts_0005 + register: guest_info_0005 - - debug: var=guest_facts_0005 + - debug: var=guest_info_0005 - assert: that: - - not (guest_facts_0005 is changed) + - not (guest_info_0005 is changed) diff --git a/test/integration/targets/vmware_guest_customization_info/aliases b/test/integration/targets/vmware_guest_customization_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_guest_customization_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_guest_customization_info/tasks/main.yml b/test/integration/targets/vmware_guest_customization_info/tasks/main.yml new file mode 100644 index 0000000000..a371d8a3d3 --- /dev/null +++ b/test/integration/targets/vmware_guest_customization_info/tasks/main.yml @@ -0,0 +1,40 @@ +# Test code for the vmware_guest_customization_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# TODO: vcsim does not support customizationspecmanager related functionalities + +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + setup_datastore: true + setup_virtualmachines: true + + - &vm_guest_info + name: Gather info about given customization spec + vmware_guest_customization_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + register: vm_custom_spec_info + + - debug: + var: vm_custom_spec_info + + - assert: + that: + - "not vm_custom_spec_info.changed" + + - <<: *vm_guest_info + name: Gather info about given customization spec in check module + + - debug: + var: vm_custom_spec_info + + - assert: + that: + - "not vm_custom_spec_info.changed" diff --git a/test/integration/targets/vmware_guest_disk_info/aliases b/test/integration/targets/vmware_guest_disk_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_guest_disk_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_guest_disk_info/tasks/main.yml b/test/integration/targets/vmware_guest_disk_info/tasks/main.yml new file mode 100644 index 0000000000..501084e312 --- /dev/null +++ b/test/integration/targets/vmware_guest_disk_info/tasks/main.yml @@ -0,0 +1,43 @@ +# Test code for the vmware_guest_disk_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + setup_datastore: true + setup_virtualmachines: true + + +- name: Gather info about virtual machine disks + vmware_guest_disk_info: &get_info + validate_certs: no + hostname: '{{ vcenter_hostname }}' + username: '{{ vcenter_username }}' + password: '{{ vcenter_password }}' + name: "{{ virtual_machines[0].name }}" + datacenter: '{{ dc1 }}' + register: disk_info + +- debug: + msg: '{{ disk_info }}' + +- name: assert that no changes were made + assert: + that: + - "not disk_info.changed" + +- name: Gather info about virtual machine disks in check mode + vmware_guest_disk_info: + <<: *get_info + register: disk_info + check_mode: yes + +- debug: + msg: '{{ disk_info }}' + +- name: assert that no changes were made + assert: + that: + - "not disk_info.changed" diff --git a/test/integration/targets/vmware_guest_find/tasks/main.yml b/test/integration/targets/vmware_guest_find/tasks/main.yml index d1e635a86a..3398d24b2d 100644 --- a/test/integration/targets/vmware_guest_find/tasks/main.yml +++ b/test/integration/targets/vmware_guest_find/tasks/main.yml @@ -32,7 +32,7 @@ with_items: "{{ folders.results }}" - name: get fact of the first VM - vmware_guest_facts: + vmware_guest_info: validate_certs: False hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" @@ -40,9 +40,9 @@ datacenter: "{{ dc1 }}" name: "{{ virtual_machines[0].name }}" folder: "{{ virtual_machines[0].folder }}" - register: guest_facts_0001 + register: guest_info_0001 -- debug: var=guest_facts_0001 +- debug: var=guest_info_0001 - name: find folders for each vm using UUID vmware_guest_find: @@ -50,7 +50,7 @@ hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" - uuid: "{{ guest_facts_0001['instance']['hw_product_uuid'] }}" + uuid: "{{ guest_info_0001['instance']['hw_product_uuid'] }}" register: folder_uuid - debug: var=folder_uuid diff --git a/test/integration/targets/vmware_guest_info/aliases b/test/integration/targets/vmware_guest_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_guest_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_guest_info/tasks/main.yml b/test/integration/targets/vmware_guest_info/tasks/main.yml new file mode 100644 index 0000000000..cebfed0ad3 --- /dev/null +++ b/test/integration/targets/vmware_guest_info/tasks/main.yml @@ -0,0 +1,226 @@ +# Test code for the vmware_guest_info module. +# Copyright: (c) 2017, Abhijeet Kasurde <akasurde@redhat.com> +# Copyright: (c) 2018, James E. King III (@jeking3) <jking@apache.org> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + setup_datastore: true + setup_virtualmachines: true + +# Testcase 0001: Get details about virtual machines +- name: get list of info about virtual machines + vmware_guest_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + name: "{{ virtual_machines[0].name }}" + folder: "{{ virtual_machines[0].folder }}" + register: guest_info_0001 + +- debug: + var: guest_info_0001 + +- assert: + that: + - "guest_info_0001['instance']['hw_name'] == virtual_machines[0].name" + - "guest_info_0001['instance']['hw_product_uuid'] is defined" + - "guest_info_0001['instance']['hw_cores_per_socket'] is defined" + - "guest_info_0001['instance']['hw_datastores'] is defined" + - "guest_info_0001['instance']['hw_esxi_host'] is defined" + - "guest_info_0001['instance']['hw_files'] is defined" + - "guest_info_0001['instance']['hw_guest_ha_state'] is defined" + - "guest_info_0001['instance']['hw_is_template'] is defined" + - "guest_info_0001['instance']['hw_folder'] is defined" + - "guest_info_0001['instance']['guest_question'] is defined" + - "guest_info_0001['instance']['guest_consolidation_needed'] is defined" + - "guest_info_0001['instance']['moid'] is defined" + - "guest_info_0001['instance']['vimref'] is defined" + - "'portgroup_portkey' in guest_info_0001['instance']['hw_eth0']" + - "'portgroup_key' in guest_info_0001['instance']['hw_eth0']" + - "guest_info_0001['instance']['instance_uuid'] is defined" + +- set_fact: vm1_uuid="{{ guest_info_0001['instance']['hw_product_uuid'] }}" + +- set_fact: vm1_instance_uuid="{{ guest_info_0001['instance']['instance_uuid'] }}" + +- set_fact: vm1_moid="{{ guest_info_0001['instance']['moid'] }}" + +- debug: + var: vm1_uuid + +# Testcase 0002: Get details about virtual machines using UUID +- name: get list of info about virtual machines using UUID + vmware_guest_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + uuid: "{{ vm1_uuid }}" + register: guest_info_0002 + +- debug: + var: guest_info_0002 + +- name: Get specific details about virtual machines using the vsphere output schema + vmware_guest_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + uuid: "{{ vm1_uuid }}" + schema: vsphere + properties: + - config.hardware.memoryMB + - guest + - name + - summary.runtime.connectionState + register: guest_info_0002b + +- debug: + var: guest_info_0002b + +- assert: + that: + - "guest_info_0002['instance']['hw_name'] == virtual_machines[0].name" + - "guest_info_0002['instance']['hw_product_uuid'] is defined" + - "guest_info_0002['instance']['hw_product_uuid'] == vm1_uuid" + - "guest_info_0002['instance']['hw_cores_per_socket'] is defined" + - "guest_info_0002b['instance']['config']['hardware']['memoryMB'] is defined" + - "guest_info_0002b['instance']['config']['hardware']['numCoresPerSocket'] is not defined" + - "guest_info_0002b['instance']['guest']['toolsVersion'] is defined" + - "guest_info_0001['instance']['moid'] is defined" + - "guest_info_0001['instance']['vimref'] is defined" + - "guest_info_0002b['instance']['overallStatus'] is not defined" + +# Testcase 0003: Get details about virtual machines without snapshots using UUID +- name: get empty list of snapshots from virtual machine using UUID + vmware_guest_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + uuid: "{{ vm1_uuid }}" + register: guest_info_0003 + +- debug: + var: guest_info_0003 + +- assert: + that: + - "guest_info_0003['instance']['snapshots']|length == 0" + - "guest_info_0003['instance']['current_snapshot'] is none" + +# Testcase 0004: Get details about virtual machines with two snapshots using UUID +- name: Create first snapshot + vmware_guest_snapshot: &vm_snap + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + name: "{{ virtual_machines[0].name }}" + folder: "{{ virtual_machines[0].folder }}" + state: present + snapshot_name: snap1 + +- name: Create second snapshot + vmware_guest_snapshot: + <<: *vm_snap + snapshot_name: snap2 + +- name: get list of snapshots from virtual machine using UUID + vmware_guest_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + uuid: "{{ vm1_uuid }}" + register: guest_info_0004 + +- debug: + var: guest_info_0004 + +- assert: + that: + - "guest_info_0004['instance']['snapshots'] is defined" + - "guest_info_0004['instance']['snapshots'][0]['name'] == 'snap1'" + - "guest_info_0004['instance']['snapshots'][1]['name'] == 'snap2'" + - "guest_info_0004['instance']['current_snapshot']['name'] == 'snap2'" + - "guest_info_0004['instance']['hw_folder'] is defined" + +# Testcase 0005: Get details about virtual machines using UUID +- name: get list of info about virtual machines using instance UUID + vmware_guest_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + uuid: "{{ vm1_instance_uuid }}" + use_instance_uuid: True + register: guest_info_0005 + +- debug: + msg: "{{ guest_info_0005 }}" + +- assert: + that: + - "guest_info_0005['instance']['hw_name'] == virtual_machines[0].name" + - "guest_info_0005['instance']['hw_product_uuid'] is defined" + - "guest_info_0005['instance']['hw_product_uuid'] == vm1_uuid" + - "guest_info_0005['instance']['hw_cores_per_socket'] is defined" + - "guest_info_0005['instance']['hw_datastores'] is defined" + - "guest_info_0005['instance']['hw_esxi_host'] is defined" + - "guest_info_0005['instance']['hw_files'] is defined" + - "guest_info_0005['instance']['hw_guest_ha_state'] is defined" + - "guest_info_0005['instance']['hw_is_template'] is defined" + - "guest_info_0005['instance']['hw_folder'] is defined" + - "guest_info_0005['instance']['guest_question'] is defined" + - "guest_info_0005['instance']['guest_consolidation_needed'] is defined" + - "guest_info_0005['instance']['instance_uuid'] is defined" + - "guest_info_0005['instance']['instance_uuid'] == vm1_instance_uuid" + - "guest_info_0005['instance']['moid'] is defined" + - "guest_info_0005['instance']['vimref'] is defined" + +# Testcase 0006: Get details about virtual machines using MoID +- name: get list of information about virtual machines using instance MoID + vmware_guest_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + moid: "{{ vm1_moid }}" + use_instance_uuid: True + register: guest_info_0006 + +- debug: + msg: "{{ guest_info_0006 }}" + +- assert: + that: + - "guest_info_0006['instance']['hw_name'] == virtual_machines[0].name" + - "guest_info_0006['instance']['hw_product_uuid'] is defined" + - "guest_info_0006['instance']['hw_product_uuid'] == vm1_uuid" + - "guest_info_0006['instance']['hw_cores_per_socket'] is defined" + - "guest_info_0006['instance']['hw_datastores'] is defined" + - "guest_info_0006['instance']['hw_esxi_host'] is defined" + - "guest_info_0006['instance']['hw_files'] is defined" + - "guest_info_0006['instance']['hw_guest_ha_state'] is defined" + - "guest_info_0006['instance']['hw_is_template'] is defined" + - "guest_info_0006['instance']['hw_folder'] is defined" + - "guest_info_0006['instance']['guest_question'] is defined" + - "guest_info_0006['instance']['guest_consolidation_needed'] is defined" + - "guest_info_0006['instance']['instance_uuid'] is defined" + - "guest_info_0006['instance']['instance_uuid'] == vm1_instance_uuid" + - "guest_info_0006['instance']['moid'] is defined" + - "guest_info_0006['instance']['vimref'] is defined" diff --git a/test/integration/targets/vmware_guest_move/tasks/main.yml b/test/integration/targets/vmware_guest_move/tasks/main.yml index 692fa6ee77..e540bf884a 100644 --- a/test/integration/targets/vmware_guest_move/tasks/main.yml +++ b/test/integration/targets/vmware_guest_move/tasks/main.yml @@ -31,7 +31,7 @@ name: '{{ virtual_machines[0].name }}' # Depends-On: https://github.com/ansible/ansible/pull/55237 dest_folder: '{{ dest_folder.result.path }}' - register: vm_facts_0001 + register: vm_info_0001 # Testcase 0002: Move vm and get OK status (Already Moved) @@ -45,19 +45,19 @@ datacenter: '{{ dc1 }}' name: '{{ virtual_machines[0].name }}' dest_folder: '{{ dest_folder.result.path }}' - register: vm_facts_0002 + register: vm_info_0002 - debug: - msg: "{{ vm_facts_0001 }}" + msg: "{{ vm_info_0001 }}" - debug: - msg: "{{ vm_facts_0002 }}" + msg: "{{ vm_info_0002 }}" - name: Make sure changes are done assert: that: - - vm_facts_0001.changed - - not vm_facts_0002.changed + - vm_info_0001.changed + - not vm_info_0002.changed - <<: *vm_move name: Move VM in check mode diff --git a/test/integration/targets/vmware_guest_network/tasks/main.yml b/test/integration/targets/vmware_guest_network/tasks/main.yml index e7d38acd8b..bbf1bed0e1 100644 --- a/test/integration/targets/vmware_guest_network/tasks/main.yml +++ b/test/integration/targets/vmware_guest_network/tasks/main.yml @@ -18,14 +18,14 @@ username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" name: "{{ virtual_machines[0].name }}" - gather_network_facts: true - register: netadapter_facts + gather_network_info: true + register: netadapter_info - - debug: var=netadapter_facts + - debug: var=netadapter_info - name: get number of existing netowrk adapters set_fact: - netadapter_num: "{{ netadapter_facts.network_data | length }}" + netadapter_num: "{{ netadapter_info.network_data | length }}" - name: add new network adapters to virtual machine vmware_guest_network: diff --git a/test/integration/targets/vmware_guest_snapshot_info/aliases b/test/integration/targets/vmware_guest_snapshot_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_guest_snapshot_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_guest_snapshot_info/tasks/main.yml b/test/integration/targets/vmware_guest_snapshot_info/tasks/main.yml new file mode 100644 index 0000000000..81bc1fa10b --- /dev/null +++ b/test/integration/targets/vmware_guest_snapshot_info/tasks/main.yml @@ -0,0 +1,28 @@ +# Test code for the vmware_host_dns_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# TODO: vcsim does not support snapshot related functionalities +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + setup_datastore: true + setup_virtualmachines: true + +- name: Gather snapshot info about given virtual machine + vmware_guest_snapshot_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + datacenter: "{{ dc1 }}" + name: "{{ virtual_machines[0].name }}" + folder: "{{ virtual_machines[0].folder }}" + register: vm_snapshot_info + +- debug: var=vm_snapshot_info + +- assert: + that: + - '"guest_snapshots" in vm_snapshot_info' diff --git a/test/integration/targets/vmware_guest_tools_wait/tasks/main.yml b/test/integration/targets/vmware_guest_tools_wait/tasks/main.yml index 406521305d..dfa470fc3d 100644 --- a/test/integration/targets/vmware_guest_tools_wait/tasks/main.yml +++ b/test/integration/targets/vmware_guest_tools_wait/tasks/main.yml @@ -30,17 +30,17 @@ # password: "{{ vcsim_instance['json']['password'] }}" # name: "{{ vm1 | basename }}" # folder: "{{ vm1 | dirname }}" -# register: guest_facts_0001 +# register: guest_info_0001 # -#- debug: msg="{{ guest_facts_0001 }}" +#- debug: msg="{{ guest_info_0001 }}" # #- assert: # that: -# - "guest_facts_0001['instance']['hw_name'] == vm1 | basename" -# - "guest_facts_0001['instance']['hw_product_uuid'] is defined" -# - "guest_facts_0001['instance']['guest_tools_status'] == 'guestToolsRunning'" +# - "guest_info_0001['instance']['hw_name'] == vm1 | basename" +# - "guest_info_0001['instance']['hw_product_uuid'] is defined" +# - "guest_info_0001['instance']['guest_tools_status'] == 'guestToolsRunning'" # -#- set_fact: vm1_uuid="{{ guest_facts_0001['instance']['hw_product_uuid'] }}" +#- set_fact: vm1_uuid="{{ guest_info_0001['instance']['hw_product_uuid'] }}" # #- debug: var=vm1_uuid # @@ -52,13 +52,13 @@ # username: "{{ vcsim_instance['json']['username'] }}" # password: "{{ vcsim_instance['json']['password'] }}" # uuid: "{{ vm1_uuid }}" -# register: guest_facts_0002 +# register: guest_info_0002 # -#- debug: msg="{{ guest_facts_0002 }}" +#- debug: msg="{{ guest_info_0002 }}" # #- assert: # that: -# - "guest_facts_0002['instance']['hw_name'] == vm1 | basename" -# - "guest_facts_0002['instance']['hw_product_uuid'] is defined" -# - "guest_facts_0002['instance']['hw_product_uuid'] == vm1_uuid" -# - "guest_facts_0002['instance']['guest_tools_status'] == 'guestToolsRunning'" +# - "guest_info_0002['instance']['hw_name'] == vm1 | basename" +# - "guest_info_0002['instance']['hw_product_uuid'] is defined" +# - "guest_info_0002['instance']['hw_product_uuid'] == vm1_uuid" +# - "guest_info_0002['instance']['guest_tools_status'] == 'guestToolsRunning'" diff --git a/test/integration/targets/vmware_host_acceptance/tasks/main.yml b/test/integration/targets/vmware_host_acceptance/tasks/main.yml index 6c92a5a229..c23832e368 100644 --- a/test/integration/targets/vmware_host_acceptance/tasks/main.yml +++ b/test/integration/targets/vmware_host_acceptance/tasks/main.yml @@ -19,11 +19,11 @@ validate_certs: no acceptance_level: vmware_certified state: present - register: host_acceptance_facts - - debug: var=host_acceptance_facts + register: host_acceptance_info + - debug: var=host_acceptance_info - assert: that: - - host_acceptance_facts.facts is defined + - host_acceptance_info.info is defined - name: Change acceptance level of given hosts in check mode vmware_host_acceptance: @@ -34,9 +34,9 @@ validate_certs: no acceptance_level: vmware_certified state: present - register: host_acceptance_facts_check_mode + register: host_acceptance_info_check_mode check_mode: yes - - debug: var=host_acceptance_facts_check_mode + - debug: var=host_acceptance_info_check_mode - assert: that: - - host_acceptance_facts_check_mode.facts is defined + - host_acceptance_info_check_mode.info is defined diff --git a/test/integration/targets/vmware_host_active_directory/tasks/main.yml b/test/integration/targets/vmware_host_active_directory/tasks/main.yml index 2068212528..75be9c6d36 100644 --- a/test/integration/targets/vmware_host_active_directory/tasks/main.yml +++ b/test/integration/targets/vmware_host_active_directory/tasks/main.yml @@ -19,15 +19,15 @@ ad_password: '{{ active_directory_password }}' ad_state: present validate_certs: no - register: host_active_directory_facts_check_mode + register: host_active_directory_info_check_mode check_mode: yes - - debug: var=host_active_directory_facts_check_mode + - debug: var=host_active_directory_info_check_mode - assert: that: - - host_active_directory_facts_check_mode is defined - - host_active_directory_facts_check_mode.changed + - host_active_directory_info_check_mode is defined + - host_active_directory_info_check_mode.changed - name: Join an AD domain vmware_host_active_directory: @@ -40,15 +40,15 @@ ad_password: Password123$ ad_state: present validate_certs: no - register: host_active_directory_facts + register: host_active_directory_info ignore_errors: true - - debug: var=host_active_directory_facts + - debug: var=host_active_directory_info - assert: that: - - host_active_directory_facts is defined - - host_active_directory_facts.changed + - host_active_directory_info is defined + - host_active_directory_info.changed - name: Leave AD domain in check mode vmware_host_active_directory: @@ -58,15 +58,15 @@ esxi_hostname: '{{ esxi1 }}' ad_state: absent validate_certs: no - register: host_active_directory_facts_2_check_mode + register: host_active_directory_info_2_check_mode check_mode: yes - - debug: var=host_active_directory_facts_2_check_mode + - debug: var=host_active_directory_info_2_check_mode - assert: that: - - host_active_directory_facts_2_check_mode is defined - - host_active_directory_facts_2_check_mode.changed + - host_active_directory_info_2_check_mode is defined + - host_active_directory_info_2_check_mode.changed - name: Leave AD domain vmware_host_active_directory: @@ -76,12 +76,12 @@ esxi_hostname: '{{ esxi1 }}' ad_state: absent validate_certs: no - register: host_active_directory_facts_2 + register: host_active_directory_info_2 ignore_errors: true - - debug: var=host_active_directory_facts_2 + - debug: var=host_active_directory_info_2 - assert: that: - - host_active_directory_facts_2 is defined - - host_active_directory_facts_2.changed + - host_active_directory_info_2 is defined + - host_active_directory_info_2.changed diff --git a/test/integration/targets/vmware_host_capability_info/aliases b/test/integration/targets/vmware_host_capability_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_host_capability_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_capability_info/tasks/main.yml b/test/integration/targets/vmware_host_capability_info/tasks/main.yml new file mode 100644 index 0000000000..14a270156a --- /dev/null +++ b/test/integration/targets/vmware_host_capability_info/tasks/main.yml @@ -0,0 +1,38 @@ +# Test code for the vmware_host_capability_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# TODO: vcsim does not support host system capabilities + +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + - name: Gather capability info for all ESXi host from given cluster + vmware_host_capability_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: False + cluster_name: "{{ ccr1 }}" + register: capability_0001_results + - assert: + that: + - not (capability_0001_results is changed) + - capability_0001_results.hosts_capability_info is defined + + - name: Gather capability info for ESXi host + vmware_host_capability_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: False + esxi_hostname: '{{ esxi1 }}' + register: capability_0002_results + - assert: + that: + - not (capability_0002_results is changed) + - capability_0002_results.hosts_capability_info is defined diff --git a/test/integration/targets/vmware_host_config_info/aliases b/test/integration/targets/vmware_host_config_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_host_config_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_config_info/tasks/main.yml b/test/integration/targets/vmware_host_config_info/tasks/main.yml new file mode 100644 index 0000000000..061ab8c5d5 --- /dev/null +++ b/test/integration/targets/vmware_host_config_info/tasks/main.yml @@ -0,0 +1,68 @@ +# Test code for the vmware_host_config_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + +- name: gather info about all hosts in given cluster + vmware_host_config_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + cluster_name: "{{ ccr1 }}" + register: all_hosts_result + +- debug: + var: all_hosts_result + +- name: ensure info are gathered for all hosts + assert: + that: + - all_hosts_result.hosts_info + +- name: gather info about all hosts in given cluster in check mode + vmware_host_config_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + cluster_name: "{{ ccr1 }}" + register: all_hosts_result_check_mode + check_mode: yes + +- name: ensure info are gathered for all hosts + assert: + that: + - all_hosts_result_check_mode.hosts_info + +- when: vcsim is not defined + block: + - name: gather info about a given host in check mode + vmware_host_config_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + esxi_hostname: "{{ esxi1 }}" + register: single_hosts_result_check_mode + check_mode: yes + - name: ensure info are gathered for all hosts + assert: + that: + - single_hosts_result_check_mode.hosts_info + + - name: gather info about a given host + vmware_host_config_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + esxi_hostname: "{{ esxi1 }}" + register: single_hosts_result + - name: ensure info are gathered for all hosts + assert: + that: + - single_hosts_result.hosts_info diff --git a/test/integration/targets/vmware_host_config_manager/tasks/main.yml b/test/integration/targets/vmware_host_config_manager/tasks/main.yml index 821a097121..2be119de92 100644 --- a/test/integration/targets/vmware_host_config_manager/tasks/main.yml +++ b/test/integration/targets/vmware_host_config_manager/tasks/main.yml @@ -27,7 +27,7 @@ # TODO: vcsim does not support update host configuartion - when: vcsim is not defined block: - - name: Change facts about all hosts in given cluster + - name: Change info about all hosts in given cluster vmware_host_config_manager: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" @@ -37,7 +37,7 @@ 'Config.HostAgent.log.level': 'verbose' validate_certs: no - - name: Change facts about a given host + - name: Change info about a given host vmware_host_config_manager: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" @@ -55,7 +55,7 @@ that: - host_result is changed - - name: Change facts about all hosts in given cluster in check mode + - name: Change info about all hosts in given cluster in check mode vmware_host_config_manager: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" @@ -72,7 +72,7 @@ that: - all_hosts_result_check_mode.changed - - name: Change facts about a given host in check mode + - name: Change info about a given host in check mode vmware_host_config_manager: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" diff --git a/test/integration/targets/vmware_host_dns_info/aliases b/test/integration/targets/vmware_host_dns_info/aliases new file mode 100644 index 0000000000..9d678a191c --- /dev/null +++ b/test/integration/targets/vmware_host_dns_info/aliases @@ -0,0 +1,4 @@ +shippable/vcenter/group1 +cloud/vcenter + +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_dns_info/tasks/main.yml b/test/integration/targets/vmware_host_dns_info/tasks/main.yml new file mode 100644 index 0000000000..cc732ff220 --- /dev/null +++ b/test/integration/targets/vmware_host_dns_info/tasks/main.yml @@ -0,0 +1,70 @@ +# Test code for the vmware_host_dns_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + +- name: gather DNS info about all hosts in given cluster + vmware_host_dns_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster_name: "{{ ccr1 }}" + validate_certs: no + register: all_hosts_dns_result + +- name: ensure DNS info are gathered for all hosts in given cluster + assert: + that: + - all_hosts_dns_result.hosts_dns_info + - not all_hosts_dns_result.changed + +- name: gather DNS info about host system + vmware_host_dns_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: all_hosts_dns_result + +- name: ensure DNS info are gathered about host system + assert: + that: + - all_hosts_dns_result.hosts_dns_info + - not all_hosts_dns_result.changed + +- name: gather DNS info about all hosts in given cluster in check mode + vmware_host_dns_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster_name: "{{ ccr1 }}" + validate_certs: no + register: all_hosts_dns_result_check_mode + check_mode: yes + +- name: ensure DNS info are gathered for all hosts in given cluster + assert: + that: + - all_hosts_dns_result_check_mode.hosts_dns_info + - not all_hosts_dns_result_check_mode.changed + +- name: gather DNS info about host system in check mode + vmware_host_dns_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: all_hosts_dns_result_check_mode + check_mode: yes + +- name: ensure DNS info are gathered about host system + assert: + that: + - all_hosts_dns_result_check_mode.hosts_dns_info + - not all_hosts_dns_result_check_mode.changed diff --git a/test/integration/targets/vmware_host_feature_info/aliases b/test/integration/targets/vmware_host_feature_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_host_feature_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_feature_info/tasks/main.yml b/test/integration/targets/vmware_host_feature_info/tasks/main.yml new file mode 100644 index 0000000000..3b57020815 --- /dev/null +++ b/test/integration/targets/vmware_host_feature_info/tasks/main.yml @@ -0,0 +1,77 @@ +# Test code for the vmware_host_feature_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# TODO: vcsim does not support host feature capabilities +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + setup_datastore: true + +- name: Gather feature capability info for all ESXi host from given cluster + vmware_host_feature_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + cluster_name: "{{ ccr1 }}" + register: capability_0001_results + +- debug: var=capability_0001_results + +- assert: + that: + - "not capability_0001_results.changed" + - "capability_0001_results.hosts_feature_info is defined" + +- name: Gather feature capability info for all ESXi host from given cluster in check mode + vmware_host_feature_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + cluster_name: "{{ ccr1 }}" + register: capability_0001_results + check_mode: yes + +- debug: var=capability_0001_results + +- assert: + that: + - "not capability_0001_results.changed" + - "capability_0001_results.hosts_feature_info is defined" + +- name: Gather feature capability info for ESXi host + vmware_host_feature_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + esxi_hostname: '{{ esxi1 }}' + register: capability_0002_results + +- debug: var=capability_0002_results + +- assert: + that: + - "not capability_0002_results.changed" + - "capability_0002_results.hosts_feature_info is defined" + + +- name: Gather feature capability info for ESXi host in check mode + vmware_host_feature_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + esxi_hostname: '{{ esxi1 }}' + register: capability_0002_results + check_mode: yes + +- debug: var=capability_0002_results + +- assert: + that: + - "not capability_0002_results.changed" + - "capability_0002_results.hosts_feature_info is defined" diff --git a/test/integration/targets/vmware_host_firewall_info/aliases b/test/integration/targets/vmware_host_firewall_info/aliases new file mode 100644 index 0000000000..9d678a191c --- /dev/null +++ b/test/integration/targets/vmware_host_firewall_info/aliases @@ -0,0 +1,4 @@ +shippable/vcenter/group1 +cloud/vcenter + +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_firewall_info/tasks/main.yml b/test/integration/targets/vmware_host_firewall_info/tasks/main.yml new file mode 100644 index 0000000000..29a8b610d0 --- /dev/null +++ b/test/integration/targets/vmware_host_firewall_info/tasks/main.yml @@ -0,0 +1,73 @@ +# Test code for the vmware_host_firewall_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + +- name: Gather firewall info for a given ESXi + vmware_host_firewall_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + esxi_hostname: '{{ esxi1 }}' + register: firewall_0004_results + check_mode: yes + +- assert: + that: + - "not firewall_0004_results.changed" + - "firewall_0004_results.hosts_firewall_info is defined" + + +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + - name: Gather firewall info for all ESXi host from given cluster + vmware_host_firewall_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + cluster_name: "{{ ccr1 }}" + register: firewall_0001_results + + - assert: + that: + - "not firewall_0001_results.changed" + - "firewall_0001_results.hosts_firewall_info is defined" + + - name: Gather firewall info for ESXi host + vmware_host_firewall_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + esxi_hostname: '{{ esxi1 }}' + register: firewall_0002_results + + - assert: + that: + - "not firewall_0002_results.changed" + - "firewall_0002_results.hosts_firewall_info is defined" + + - name: Gather firewall info for all ESXi host from given cluster in check mode + vmware_host_firewall_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + cluster_name: "{{ ccr1 }}" + register: firewall_0003_results + check_mode: yes + + - assert: + that: + - "not firewall_0003_results.changed" + - "firewall_0003_results.hosts_firewall_info is defined" diff --git a/test/integration/targets/vmware_host_firewall_manager/tasks/main.yml b/test/integration/targets/vmware_host_firewall_manager/tasks/main.yml index 07b4d33d84..02cb58ee4c 100644 --- a/test/integration/targets/vmware_host_firewall_manager/tasks/main.yml +++ b/test/integration/targets/vmware_host_firewall_manager/tasks/main.yml @@ -37,7 +37,7 @@ - all_hosts_result.changed - all_hosts_result.rule_set_state is defined - - name: ensure facts are gathered for all hosts of {{ ccr1 }} + - name: ensure info are gathered for all hosts of {{ ccr1 }} assert: that: - all_hosts_result.rule_set_state[item]['vvold']['current_state'] == True @@ -65,7 +65,7 @@ - host_result.changed - host_result.rule_set_state is defined - - name: ensure facts are gathered for {{ host1 }} + - name: ensure info are gathered for {{ host1 }} assert: that: - host_result.rule_set_state[item]['vvold']['current_state'] == False @@ -93,7 +93,7 @@ - all_hosts_result_check_mode.changed - all_hosts_result_check_mode.rule_set_state is defined - - name: ensure facts are gathered for all hosts of {{ ccr1 }} + - name: ensure info are gathered for all hosts of {{ ccr1 }} assert: that: - all_hosts_result_check_mode.rule_set_state[esxi1]['vvold']['current_state'] == True @@ -119,7 +119,7 @@ - host_result_check_mode.changed == False - host_result_check_mode.rule_set_state is defined - - name: ensure facts are gathered for {{ host1 }} + - name: ensure info are gathered for {{ host1 }} assert: that: - host_result_check_mode.rule_set_state[item]['vvold']['current_state'] == False diff --git a/test/integration/targets/vmware_host_hyperthreading/tasks/main.yml b/test/integration/targets/vmware_host_hyperthreading/tasks/main.yml index d14c1f3bab..f3f4cd8edf 100644 --- a/test/integration/targets/vmware_host_hyperthreading/tasks/main.yml +++ b/test/integration/targets/vmware_host_hyperthreading/tasks/main.yml @@ -30,14 +30,14 @@ esxi_hostname: '{{ esxi1 }}' validate_certs: no state: disabled - register: host_hyperthreading_facts + register: host_hyperthreading_info - - debug: var=host_hyperthreading_facts + - debug: var=host_hyperthreading_info - assert: that: - - host_hyperthreading_facts is defined - - host_hyperthreading_facts.changed + - host_hyperthreading_info is defined + - host_hyperthreading_info.changed - name: Disable Hyperthreading for a given host in check mode vmware_host_hyperthreading: @@ -47,14 +47,14 @@ esxi_hostname: '{{ esxi1 }}' validate_certs: no state: disabled - register: host_hyperthreading_facts_check_mode + register: host_hyperthreading_info_check_mode check_mode: yes - - debug: var=host_hyperthreading_facts_check_mode + - debug: var=host_hyperthreading_info_check_mode - assert: that: - - host_hyperthreading_facts_check_mode is defined + - host_hyperthreading_info_check_mode is defined - name: Disable Hyperthreading for all hosts in given cluster vmware_host_hyperthreading: @@ -64,14 +64,14 @@ cluster_name: "{{ ccr1 }}" validate_certs: no state: disabled - register: host_hyperthreading_facts + register: host_hyperthreading_info - - debug: var=host_hyperthreading_facts + - debug: var=host_hyperthreading_info - assert: that: - - host_hyperthreading_facts is defined - - host_hyperthreading_facts is changed + - host_hyperthreading_info is defined + - host_hyperthreading_info is changed - name: Enable Hyperthreading for all hosts in given cluster in check mode vmware_host_hyperthreading: @@ -81,12 +81,12 @@ cluster_name: "{{ ccr1 }}" validate_certs: no state: enabled - register: host_hyperthreading_facts_check_mode + register: host_hyperthreading_info_check_mode check_mode: yes - - debug: var=host_hyperthreading_facts_check_mode + - debug: var=host_hyperthreading_info_check_mode - assert: that: - - host_hyperthreading_facts_check_mode is defined - - host_hyperthreading_facts_check_mode.changed + - host_hyperthreading_info_check_mode is defined + - host_hyperthreading_info_check_mode.changed diff --git a/test/integration/targets/vmware_host_ipv6/tasks/main.yml b/test/integration/targets/vmware_host_ipv6/tasks/main.yml index 3b4bf6b8fc..755583ccb6 100644 --- a/test/integration/targets/vmware_host_ipv6/tasks/main.yml +++ b/test/integration/targets/vmware_host_ipv6/tasks/main.yml @@ -16,7 +16,7 @@ cluster_name: "{{ ccr1 }}" validate_certs: no state: disabled - register: host_ipv6_facts + register: host_ipv6_info - name: Enable IPv6 support for a given host vmware_host_ipv6: @@ -26,12 +26,12 @@ esxi_hostname: '{{ esxi1 }}' validate_certs: no state: enabled - register: host_ipv6_facts - - debug: var=host_ipv6_facts + register: host_ipv6_info + - debug: var=host_ipv6_info - assert: that: - - host_ipv6_facts is defined - - host_ipv6_facts.changed + - host_ipv6_info is defined + - host_ipv6_info.changed - name: Enable IPv6 support for a given host in check mode vmware_host_ipv6: @@ -41,13 +41,13 @@ esxi_hostname: '{{ esxi1 }}' validate_certs: no state: enabled - register: host_ipv6_facts_check_mode + register: host_ipv6_info_check_mode check_mode: yes - - debug: var=host_ipv6_facts_check_mode + - debug: var=host_ipv6_info_check_mode - assert: that: - - host_ipv6_facts_check_mode is defined - - not (host_ipv6_facts_check_mode is changed) + - host_ipv6_info_check_mode is defined + - not (host_ipv6_info_check_mode is changed) - name: Enable IPv6 support for all hosts in given cluster vmware_host_ipv6: @@ -57,12 +57,12 @@ cluster_name: "{{ ccr1 }}" validate_certs: no state: enabled - register: hosts_ipv6_facts - - debug: var=hosts_ipv6_facts + register: hosts_ipv6_info + - debug: var=hosts_ipv6_info - assert: that: - - hosts_ipv6_facts is defined - - hosts_ipv6_facts.changed + - hosts_ipv6_info is defined + - hosts_ipv6_info.changed - name: Enable IPv6 support for all hosts in given cluster in check mode vmware_host_ipv6: @@ -72,10 +72,10 @@ cluster_name: "{{ ccr1 }}" validate_certs: no state: enabled - register: hosts_ipv6_facts_check_mode + register: hosts_ipv6_info_check_mode check_mode: yes - - debug: var=hosts_ipv6_facts_check_mode + - debug: var=hosts_ipv6_info_check_mode - assert: that: - - hosts_ipv6_facts_check_mode is defined - - not (hosts_ipv6_facts_check_mode is changed) + - hosts_ipv6_info_check_mode is defined + - not (hosts_ipv6_info_check_mode is changed) diff --git a/test/integration/targets/vmware_host_ntp_info/aliases b/test/integration/targets/vmware_host_ntp_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_host_ntp_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_ntp_info/tasks/main.yml b/test/integration/targets/vmware_host_ntp_info/tasks/main.yml new file mode 100644 index 0000000000..16d240e9f7 --- /dev/null +++ b/test/integration/targets/vmware_host_ntp_info/tasks/main.yml @@ -0,0 +1,24 @@ +# Test code for the vmware_host_ntp_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# TODO: vcsim does not support NTP Manager related to operations +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + - name: Gather NTP info about all hosts in given host + vmware_host_ntp_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: host_ntp + - debug: var=host_ntp + - assert: + that: + - host_ntp.hosts_ntp_info is defined diff --git a/test/integration/targets/vmware_host_package_info/aliases b/test/integration/targets/vmware_host_package_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_host_package_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_package_info/tasks/main.yml b/test/integration/targets/vmware_host_package_info/tasks/main.yml new file mode 100644 index 0000000000..c4482efc6c --- /dev/null +++ b/test/integration/targets/vmware_host_package_info/tasks/main.yml @@ -0,0 +1,24 @@ +# Test code for the vmware_host_package_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# TODO: vcsim does not support Package Manager related to operations +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + - name: Gather info about all hosts in given cluster + vmware_host_package_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: host_packages + - debug: var=host_packages + - assert: + that: + - host_packages.hosts_package_info is defined diff --git a/test/integration/targets/vmware_host_service_info/aliases b/test/integration/targets/vmware_host_service_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_host_service_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_service_info/tasks/main.yml b/test/integration/targets/vmware_host_service_info/tasks/main.yml new file mode 100644 index 0000000000..60f8725075 --- /dev/null +++ b/test/integration/targets/vmware_host_service_info/tasks/main.yml @@ -0,0 +1,39 @@ +# Test code for the vmware_host_service_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# TODO: vcsim does not support service related to operations +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + - &host_srv_info + name: Check info about all hosts in given cluster + vmware_host_service_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: host_services + + - debug: + var: host_services + + - assert: + that: + - host_services.host_service_info is defined + + - <<: *host_srv_info + name: Check info about all hosts in given cluster in check mode + check_mode: yes + + - debug: + var: host_services + + - assert: + that: + - host_services.host_service_info is defined diff --git a/test/integration/targets/vmware_host_service_manager/tasks/main.yml b/test/integration/targets/vmware_host_service_manager/tasks/main.yml index 6f56d0625d..7098675ef4 100644 --- a/test/integration/targets/vmware_host_service_manager/tasks/main.yml +++ b/test/integration/targets/vmware_host_service_manager/tasks/main.yml @@ -33,7 +33,7 @@ service_name: ntpd state: absent register: single_hosts_result - - name: ensure facts are gathered + - name: ensure info are gathered assert: that: - single_hosts_result is changed @@ -49,7 +49,7 @@ state: present register: all_hosts_result_check_mode check_mode: yes - - name: ensure facts are gathered for all hosts + - name: ensure info are gathered for all hosts assert: that: - all_hosts_result_check_mode is changed @@ -65,7 +65,7 @@ state: absent register: single_hosts_result_check_mode check_mode: yes - - name: ensure facts are gathered + - name: ensure info are gathered assert: that: - not (single_hosts_result_check_mode is changed) diff --git a/test/integration/targets/vmware_host_ssl_info/aliases b/test/integration/targets/vmware_host_ssl_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_host_ssl_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_ssl_info/tasks/main.yml b/test/integration/targets/vmware_host_ssl_info/tasks/main.yml new file mode 100644 index 0000000000..f2eb77112b --- /dev/null +++ b/test/integration/targets/vmware_host_ssl_info/tasks/main.yml @@ -0,0 +1,70 @@ +# Test code for the vmware_host_ssl_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + +- name: Gather SSL info about ESXi machine + vmware_host_ssl_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: ssl_info + +- debug: var=ssl_info + +- assert: + that: + - ssl_info.host_ssl_info is defined + +- name: Gather info about all hostsystem in given cluster + vmware_host_ssl_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster_name: "{{ ccr1 }}" + validate_certs: no + register: ssl_info + +- debug: var=ssl_info + +- assert: + that: + - ssl_info.host_ssl_info is defined + +- name: Gather SSL info about ESXi machine in check mode + vmware_host_ssl_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + check_mode: yes + register: ssl_info + +- debug: var=ssl_info + +- assert: + that: + - ssl_info.host_ssl_info is defined + +- name: Gather info about all hostsystem in given cluster in check mode ee + vmware_host_ssl_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + cluster_name: "{{ ccr1 }}" + validate_certs: no + check_mode: yes + register: ssl_info + +- debug: var=ssl_info + +- assert: + that: + - ssl_info.host_ssl_info is defined diff --git a/test/integration/targets/vmware_host_vmhba_info/aliases b/test/integration/targets/vmware_host_vmhba_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_host_vmhba_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_vmhba_info/tasks/main.yml b/test/integration/targets/vmware_host_vmhba_info/tasks/main.yml new file mode 100644 index 0000000000..bfb014cfe3 --- /dev/null +++ b/test/integration/targets/vmware_host_vmhba_info/tasks/main.yml @@ -0,0 +1,39 @@ +# Test code for the vmware_host_vmhba_info module. +# Copyright: (c) 2018, Christian Kotte <christian.kotte@gmx.de> +# 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 + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + - &vmhba_data + name: Gather vmhba info + vmware_host_vmhba_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: host_vmhbas + + - debug: + var: host_vmhbas + + - assert: + that: + - host_vmhbas.hosts_vmhbas_info is defined + + - <<: *vmhba_data + name: Gather vmhba info in check mode + check_mode: yes + + - debug: + var: host_vmhbas + + - assert: + that: + - host_vmhbas.hosts_vmhbas_info is defined diff --git a/test/integration/targets/vmware_host_vmnic_info/aliases b/test/integration/targets/vmware_host_vmnic_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_host_vmnic_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_host_vmnic_info/tasks/main.yml b/test/integration/targets/vmware_host_vmnic_info/tasks/main.yml new file mode 100644 index 0000000000..722bd61701 --- /dev/null +++ b/test/integration/targets/vmware_host_vmnic_info/tasks/main.yml @@ -0,0 +1,40 @@ +# Test code for the vmware_host_vmnic_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# 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 + block: + - 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: no + 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: no + 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 diff --git a/test/integration/targets/vmware_local_role_info/aliases b/test/integration/targets/vmware_local_role_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_local_role_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_local_role_info/tasks/main.yml b/test/integration/targets/vmware_local_role_info/tasks/main.yml new file mode 100644 index 0000000000..fd3af19a43 --- /dev/null +++ b/test/integration/targets/vmware_local_role_info/tasks/main.yml @@ -0,0 +1,39 @@ +# Test code for the vmware_local_role_info module +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + +- name: Set list of Roles in fact + set_fact: + role_list: + - Admin + - NoCryptoAdmin + - NoAccess + - Anonymous + - ReadOnly + +- &role_data + name: Gather Role info + vmware_local_role_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + register: role_details + +- &role_test + name: Test if role id is present for role + assert: + that: "{{ role_details.local_role_info | json_query(s_query) != [] }}" + vars: + s_query: "[?role_name == '{{ item }}'].role_id" + with_items: "{{ role_list }}" + +- <<: *role_data + name: Gather Role info in check mode + check_mode: yes + +- <<: *role_test + name: Test if role id is present for role in check mode diff --git a/test/integration/targets/vmware_local_user_info/aliases b/test/integration/targets/vmware_local_user_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_local_user_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_local_user_info/tasks/main.yml b/test/integration/targets/vmware_local_user_info/tasks/main.yml new file mode 100644 index 0000000000..f1985cca89 --- /dev/null +++ b/test/integration/targets/vmware_local_user_info/tasks/main.yml @@ -0,0 +1,38 @@ +# Test code for the vmware_local_user_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# Commenting local user testcases as older vcsim docker image +# does not support this. +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_esxi_instance: true + + # Local user manager works only with standalone ESXi server + - &user_info_data + name: Gather info about users + vmware_local_user_info: + hostname: "{{ esxi1 }}" + username: "{{ esxi_user }}" + password: "{{ esxi_password }}" + validate_certs: False + register: all_user_info + + - name: ensure user info are gathered + assert: + that: + - not all_user_info.changed + - all_user_info.local_user_info is defined + + - <<: *user_info_data + name: Gather info about users in check mode + check_mode: yes + + - name: ensure user info are gathered + assert: + that: + - not all_user_info.changed + - all_user_info.local_user_info is defined diff --git a/test/integration/targets/vmware_portgroup_info/aliases b/test/integration/targets/vmware_portgroup_info/aliases new file mode 100644 index 0000000000..9d678a191c --- /dev/null +++ b/test/integration/targets/vmware_portgroup_info/aliases @@ -0,0 +1,4 @@ +shippable/vcenter/group1 +cloud/vcenter + +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_portgroup_info/tasks/main.yml b/test/integration/targets/vmware_portgroup_info/tasks/main.yml new file mode 100644 index 0000000000..f79ff9a673 --- /dev/null +++ b/test/integration/targets/vmware_portgroup_info/tasks/main.yml @@ -0,0 +1,67 @@ +# Test code for the vmware_portgroup_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + +- name: Gather portgroup info for all ESXi host from given cluster + vmware_portgroup_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + cluster_name: "{{ ccr1 }}" + register: portgroup_0001_results + +- assert: + that: + - "not portgroup_0001_results.changed" + - "portgroup_0001_results.hosts_portgroup_info is defined" + +- name: Gather portgroup info for an ESXi host + vmware_portgroup_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + esxi_hostname: '{{ esxi1 }}' + register: portgroup_0002_results + +- assert: + that: + - "not portgroup_0002_results.changed" + - "portgroup_0002_results.hosts_portgroup_info is defined" + +- name: Gather all portgroup info for an ESXi host + vmware_portgroup_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + esxi_hostname: '{{ esxi1 }}' + policies: true + register: portgroup_0003_results + +- assert: + that: + - "not portgroup_0003_results.changed" + - "portgroup_0003_results.hosts_portgroup_info is defined" + +- name: Gather all portgroup info for an ESXi host in check mode + vmware_portgroup_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + esxi_hostname: '{{ esxi1 }}' + policies: true + register: portgroup_0004_results + check_mode: yes + +- assert: + that: + - "not portgroup_0004_results.changed" + - "portgroup_0004_results.hosts_portgroup_info is defined" diff --git a/test/integration/targets/vmware_resource_pool_info/aliases b/test/integration/targets/vmware_resource_pool_info/aliases new file mode 100644 index 0000000000..eb39c07bac --- /dev/null +++ b/test/integration/targets/vmware_resource_pool_info/aliases @@ -0,0 +1,3 @@ +shippable/vcenter/group1 +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_resource_pool_info/tasks/main.yml b/test/integration/targets/vmware_resource_pool_info/tasks/main.yml new file mode 100644 index 0000000000..51efa23944 --- /dev/null +++ b/test/integration/targets/vmware_resource_pool_info/tasks/main.yml @@ -0,0 +1,20 @@ +# Test code for the vmware_resource_pool_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + +- name: Gather info about resource pool + vmware_resource_pool_info: + validate_certs: False + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + register: resource_result_0001 + +- name: ensure a resource pool is present + assert: + that: + - "{{ resource_result_0001.changed == false }}" + - "{{ resource_result_0001.resource_pool_info is defined }}" diff --git a/test/integration/targets/vmware_tag/tasks/tag_manager_ops.yml b/test/integration/targets/vmware_tag/tasks/tag_manager_ops.yml index 47313323e4..1e949e0e11 100644 --- a/test/integration/targets/vmware_tag/tasks/tag_manager_ops.yml +++ b/test/integration/targets/vmware_tag/tasks/tag_manager_ops.yml @@ -6,30 +6,30 @@ - when: vcsim is not defined block: - name: Get VM Facts - vmware_vm_facts: + vmware_vm_info: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' validate_certs: False - register: vm_facts + register: vm_info - - set_fact: vm_name="{{ vm_facts['virtual_machines'][0]['guest_name'] }}" + - set_fact: vm_name="{{ vm_info['virtual_machines'][0]['guest_name'] }}" # Get Tagname - - &tag_fact - name: Get facts about tag - vmware_tag_facts: + - &tag_info + name: Get info about tag + vmware_tag_info: hostname: '{{ vcenter_hostname }}' username: '{{ vcenter_username }}' password: '{{ vcenter_password }}' validate_certs: False - register: tag_facts + register: tag_info - - <<: *tag_fact - name: Get facts about tag in check mode + - <<: *tag_info + name: Get info about tag in check mode check_mode: yes - - set_fact: Tag_Name={{ tag_facts['tag_facts'].keys() | list }} + - set_fact: Tag_Name={{ tag_info['tag_info'].keys() | list }} - debug: var=Tag_Name diff --git a/test/integration/targets/vmware_target_canonical_info/aliases b/test/integration/targets/vmware_target_canonical_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_target_canonical_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_target_canonical_info/tasks/main.yml b/test/integration/targets/vmware_target_canonical_info/tasks/main.yml new file mode 100644 index 0000000000..a30abab45b --- /dev/null +++ b/test/integration/targets/vmware_target_canonical_info/tasks/main.yml @@ -0,0 +1,38 @@ +# Test code for the vmware_target_canonical_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# TODO: vcsim does not support SCSI target releated operations +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + +- name: Gather target info for all ESXi host from given cluster + vmware_target_canonical_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: False + cluster_name: "{{ ccr1 }}" + register: target_0001_results + +- assert: + that: + - "not target_0001_results.changed" + - "target_0001_results.scsi_tgt_info is defined" + +- name: Gather target info for ESXi host + vmware_target_canonical_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: False + esxi_hostname: '{{ esxi1 }}' + register: target_0002_results + +- assert: + that: + - "not target_0002_results.changed" + - "target_0002_results.scsi_tgt_info is defined" diff --git a/test/integration/targets/vmware_vm_info/aliases b/test/integration/targets/vmware_vm_info/aliases new file mode 100644 index 0000000000..1eb4d71b09 --- /dev/null +++ b/test/integration/targets/vmware_vm_info/aliases @@ -0,0 +1,4 @@ +shippable/vcenter/group1 +shippable/vcenter/smoketest +cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_vm_info/tasks/main.yml b/test/integration/targets/vmware_vm_info/tasks/main.yml new file mode 100644 index 0000000000..a291a2c0c4 --- /dev/null +++ b/test/integration/targets/vmware_vm_info/tasks/main.yml @@ -0,0 +1,99 @@ +# Test code for the vmware_vm_info module +# Copyright: (c) 2017, Abhijeet Kasurde <akasurde@redhat.com> +# Copyright, (c) 2018, Fedor Vompe <f.vompe@comptek.ru> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + vars: + setup_datastore: true + setup_virtualmachines: true + +- when: vcsim is not defined + block: + - name: Get info from a given ESXi + vmware_vm_info: + validate_certs: false + hostname: '{{ esxi1 }}' + username: '{{ esxi_user }}' + password: '{{ esxi_password }}' + +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + setup_datastore: true + setup_virtualmachines: true + +- &vm_data + name: Get info about available vms + vmware_vm_info: + validate_certs: false + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + register: vm_info_0001 + +- debug: var=vm_info_0001 + +- &vm_info_check + name: Verify if VM info exist + assert: + that: + - "item.esxi_hostname is defined" + - "item.guest_fullname is defined" + - "item.ip_address is defined" + - "item.mac_address is defined" + - "item.power_state is defined" + - "item.uuid is defined" + - "item.vm_network is defined" + with_items: + - "{{ vm_info_0001.virtual_machines | json_query(query) }}" + vars: + query: "[?guest_name=='DC0_H0_VM0']" + +- <<: *vm_data + name: Get info about available vms in check mode + check_mode: yes + +- <<: *vm_info_check + name: Verify if VM info exist in check mode + +- name: Get folder name from VM + vmware_guest_find: + validate_certs: false + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + name: "{{ virtual_machines[0].name }}" + register: folder_path_info + +- set_fact: + folder_path: "{{ folder_path_info.folders[0] }}" + when: folder_path_info.folders is defined + +- name: Gather info about VM using folder + vmware_vm_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + validate_certs: no + folder: "{{ folder_path }}" + register: vm_info + when: folder_path_info.folders is defined +- debug: var=vm_info + +- name: Check if info are returned for VM with folder specified + assert: + that: + - "item.esxi_hostname is defined" + - "item.guest_fullname is defined" + - "item.ip_address is defined" + - "item.mac_address is defined" + - "item.power_state is defined" + - "item.uuid is defined" + - "item.vm_network is defined" + with_items: + - "{{ vm_info.virtual_machines | json_query(query) }}" + vars: + query: "[?guest_name=='DC0_H0_VM0']" diff --git a/test/integration/targets/vmware_vmkernel_info/aliases b/test/integration/targets/vmware_vmkernel_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_vmkernel_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_vmkernel_info/tasks/main.yml b/test/integration/targets/vmware_vmkernel_info/tasks/main.yml new file mode 100644 index 0000000000..8c11359f88 --- /dev/null +++ b/test/integration/targets/vmware_vmkernel_info/tasks/main.yml @@ -0,0 +1,38 @@ +# Test code for the vmware_vmkernel_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# TODO: vcsim does not support HostVirtualNicManager related to operations +- when: vcsim is not defined + block: + - import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + + - name: Gather VMkernel info for a given host + vmware_vmkernel_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: host_vmkernel + - debug: var=host_vmkernel + - assert: + that: + - host_vmkernel.host_vmk_info is defined + + - name: Gather VMkernel info for a given host in check mode + vmware_vmkernel_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: host_vmkernel_check_mode + check_mode: yes + - debug: var=host_vmkernel + - assert: + that: + - host_vmkernel_check_mode.host_vmk_info is defined diff --git a/test/integration/targets/vmware_vswitch_info/aliases b/test/integration/targets/vmware_vswitch_info/aliases new file mode 100644 index 0000000000..3eede2cbf0 --- /dev/null +++ b/test/integration/targets/vmware_vswitch_info/aliases @@ -0,0 +1,3 @@ +cloud/vcenter +shippable/vcenter/group1 +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_vswitch_info/tasks/main.yml b/test/integration/targets/vmware_vswitch_info/tasks/main.yml new file mode 100644 index 0000000000..87658f0a9b --- /dev/null +++ b/test/integration/targets/vmware_vswitch_info/tasks/main.yml @@ -0,0 +1,41 @@ +# Test code for the vmware_vswitch_info module. +# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +- import_role: + name: prepare_vmware_tests + vars: + setup_attach_host: true + +# TODO: vcsim does not support networkConfig related to operations + +- name: Gather vswitch info about all hosts in given cluster + vmware_vswitch_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: switch_info + +- debug: var=switch_info + +- assert: + that: + - switch_info.hosts_vswitch_info is defined + +- name: Gather vswitch info about all hosts in given cluster in check mode + vmware_vswitch_info: + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" + esxi_hostname: '{{ esxi1 }}' + validate_certs: no + register: switch_info_check_mode + check_mode: yes + +- debug: var=switch_info_check_mode + +- assert: + that: + - switch_info_check_mode.hosts_vswitch_info is defined |