0e83384dfd
Refactoring of the following roles to make use of the new `prepare_vmware_tests` role. - `vmware_datacenter` - `vmware_datastore_cluster` - `vmware_datastore_facts` - `vmware_datastore_maintenancemode` This patch depends on: https://github.com/ansible/ansible/pull/55719 Original PR: https://github.com/ansible/ansible/pull/54882
50 lines
1.2 KiB
YAML
50 lines
1.2 KiB
YAML
# Test code for the vmware_datacenter module.
|
|
# Copyright: (c) 2017, 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
|
|
|
|
- &add_dc
|
|
name: Add datacenter
|
|
vmware_datacenter:
|
|
validate_certs: False
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
datacenter_name: datacenter_0001
|
|
state: present
|
|
register: dc_result
|
|
|
|
- debug:
|
|
var: dc_result
|
|
|
|
- name: Ensure datacenter is present
|
|
assert:
|
|
that:
|
|
- dc_result.changed
|
|
|
|
- <<: *add_dc
|
|
name: add datacenter again to check idempotent behavior
|
|
|
|
- name: Ensure datacenter status is not changed
|
|
assert:
|
|
that:
|
|
- not dc_result.changed
|
|
|
|
- when: vcsim is not defined
|
|
block:
|
|
- name: Delete datacenter
|
|
vmware_datacenter:
|
|
validate_certs: False
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
datacenter_name: datacenter_0001
|
|
state: absent
|
|
register: dc_result_delete
|
|
|
|
- name: Ensure datacenter is absent
|
|
assert:
|
|
that:
|
|
- dc_result_delete.changed
|