-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run content_template test on eco-vcenter
- Loading branch information
1 parent
dff9d42
commit 962c18b
Showing
3 changed files
with
104 additions
and
18 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
tests/integration/targets/content_template/defaults/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
vcenter_port: 443 | ||
run_on_simulator: false | ||
|
||
vm: test-content_template | ||
vm_cluster: "Eco-Cluster" | ||
vm_datacenter: "Eco-Datacenter" | ||
vm_folder: "/Eco-Datacenter/vm/e2e-qe" | ||
vm_guest_id: "rhel8_64Guest" | ||
vm_disk: | ||
- size_gb: 10 | ||
type: thin | ||
autoselect_datastore: true | ||
vm_hardware: | ||
memory_mb: 2000 | ||
num_cpus: 2 | ||
boot_firmware: efi | ||
|
||
template_host: 10.46.29.208 | ||
datastore: datastore2 | ||
library: content_template_library | ||
template_name: template-test-content_template |
95 changes: 78 additions & 17 deletions
95
tests/integration/targets/content_template/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,80 @@ | ||
--- | ||
- name: Create template from vm in content library | ||
vmware.vmware.content_template: | ||
validate_certs: false | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
port: "{{ vcenter_port }}" | ||
template: mytemplate | ||
library: templates | ||
vm_name: test | ||
host: 1.2.3.4. | ||
register: __res | ||
- block: | ||
- name: "Test setup: Create VM guest {{ vm }}" | ||
community.vmware.vmware_guest: | ||
validate_certs: false | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
cluster: "{{ vm_cluster }}" | ||
datacenter: "{{ vm_datacenter }}" | ||
folder: "{{ vm_folder }}" | ||
state: present | ||
name: "{{ vm }}" | ||
disk: "{{ vm_disk }}" | ||
guest_id: "{{ vm_guest_id }}" | ||
hardware: "{{ vm_hardware }}" | ||
when: not run_on_simulator | ||
|
||
- name: Assert values | ||
ansible.builtin.assert: | ||
that: | ||
- __res.changed == False | ||
- __res.template_info.msg == "Template 'mytemplate' already exists." | ||
- name: "Test setup: Create content library {{ library }}" | ||
community.vmware.vmware_content_library_manager: | ||
validate_certs: false | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
datastore_name: "{{ datastore }}" | ||
library_name: "{{ library }}" | ||
state: present | ||
library_type: local | ||
when: not run_on_simulator | ||
|
||
- name: Create template from vm in content library | ||
vmware.vmware.content_template: | ||
validate_certs: false | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
port: "{{ vcenter_port }}" | ||
template: "{{ template_name }}" | ||
library: "{{ library }}" | ||
vm_name: "{{ vm }}" | ||
host: "{{ template_host }}" | ||
register: __res | ||
|
||
- name: Assert values | ||
ansible.builtin.assert: | ||
that: | ||
- __res.changed == False | ||
- __res.template_info.msg == "Template '" + template_name + "' already exists." | ||
when: run_on_simulator | ||
|
||
- name: Assert values | ||
ansible.builtin.assert: | ||
that: | ||
- __res.changed == True | ||
- __res.template_info.msg == "Template '" + template_name + "'." | ||
when: not run_on_simulator | ||
|
||
always: | ||
- name: "Test teardown: Destroy VM guest {{ vm }}" | ||
community.vmware.vmware_guest: | ||
validate_certs: false | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
cluster: "{{ vm_cluster }}" | ||
datacenter: "{{ vm_datacenter }}" | ||
folder: "{{ vm_folder }}" | ||
state: absent | ||
force: true | ||
name: "{{ vm }}" | ||
when: not run_on_simulator | ||
|
||
- name: "Test teardown: Remove content library {{ library }}" | ||
community.vmware.vmware_content_library_manager: | ||
validate_certs: false | ||
hostname: "{{ vcenter_hostname }}" | ||
username: "{{ vcenter_username }}" | ||
password: "{{ vcenter_password }}" | ||
library_name: "{{ library }}" | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters