ansible/test/integration/targets/vmware_drs_group/tasks/main.yml
Karsten Jakobsen 8fa01a22a1 VMware: New module vmware_drs_group (#50650)
* Added new vmware module for creating DRS VM or Host groups in a given cluster
* Fixed typo in module name
* Added better docstrings. Fixed better messaging for existing groups. Added delete example.
* Update doc
* Update lib/ansible/modules/cloud/vmware/vmware_drs_group.py
* Updated logic, so result is populated with correct data even if no changes are made
* Update lib/ansible/modules/cloud/vmware/vmware_drs_group.py
* Improved performance by getting group_obj in init()
* Fixed syntax error and added group_name as required if state is
* Added state= to integration test

Co-Authored-By: karstenjakobsen <karsten@karstenjakobsen.dk>
2019-01-14 21:55:26 +05:30

99 lines
No EOL
2.3 KiB
YAML

# Test code for the vmware_drs_group 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)
- name: Store the vcenter container ip
set_fact:
vcsim: "{{ lookup('env', 'vcenter_host') }}"
- debug: var=vcsim
- name: Wait for Flask controller to come up online
wait_for:
host: "{{ vcsim }}"
port: 5000
state: started
- name: Kill vcsim
uri:
url: http://{{ vcsim }}:5000/killall
- name: Start vcsim
uri:
url: http://{{ vcsim }}:5000/spawn?cluster=2
register: vcsim_instance
- name: Wait for Flask controller to come up online
wait_for:
host: "{{ vcsim }}"
port: 443
state: started
- debug: var=vcsim_instance
- name: "Create DRS VM group"
vmware_drs_group:
# Login creds
hostname: "{{ vcsim }}"
username: "{{ vcsim_instance['json']['username'] }}"
password: "{{ vcsim_instance['json']['password'] }}"
validate_certs: False
# Options
cluster_name: DC0_C0
datacenter_name: DC0
group_name: TEST_VM_01
vms:
- DC0_C0_RP0_VM0
- DC0_C0_RP0_VM1
state: present
register: drs_vm_group_01_results
- debug: var=drs_vm_group_01_results
- assert:
that:
- "drs_vm_group_01_results.changed"
- name: "Create DRS Host group"
vmware_drs_group:
# Login creds
hostname: "{{ vcsim }}"
username: "{{ vcsim_instance['json']['username'] }}"
password: "{{ vcsim_instance['json']['password'] }}"
validate_certs: False
# Options
cluster_name: DC0_C0
datacenter_name: DC0
group_name: TEST_HOST_01
hosts:
- DC0_C0_H0
- DC0_C0_H1
- DC0_C0_H2
state: present
register: drs_host_group_01_results
- debug: var=drs_host_group_01_results
- assert:
that:
- "drs_host_group_01_results.changed"
- name: "Delete DRS Host group"
vmware_drs_group:
# Login creds
hostname: "{{ vcsim }}"
username: "{{ vcsim_instance['json']['username'] }}"
password: "{{ vcsim_instance['json']['password'] }}"
validate_certs: False
# Options
cluster_name: DC0_C0
datacenter_name: DC0
group_name: TEST_HOST_01
hosts: []
state: absent
register: drs_host_group_01_delete_results
- debug: var=drs_host_group_01_delete_results
- assert:
that:
- "drs_host_group_01_delete_results.changed"