vmware: test-suite fixes
Minor fixes for the test-suite found during the integration with the CI.
This commit is contained in:
parent
33d0d36eaa
commit
7d85cbcc6c
18 changed files with 174 additions and 161 deletions
|
@ -4,12 +4,11 @@
|
||||||
hostname: '{{ item }}'
|
hostname: '{{ item }}'
|
||||||
username: '{{ esxi_user }}'
|
username: '{{ esxi_user }}'
|
||||||
password: '{{ esxi_password }}'
|
password: '{{ esxi_password }}'
|
||||||
esxi_hostname: '{{ item }}' # Won't be necessary with https://github.com/ansible/ansible/pull/56516
|
|
||||||
datastore_name: '{{ ds1 }}'
|
datastore_name: '{{ ds1 }}'
|
||||||
datastore_type: '{{ infra.datastores[ds1].type }}'
|
datastore_type: '{{ infra.datastores[ds1].type }}'
|
||||||
nfs_server: '{{ infra.datastores[ds1].server }}'
|
nfs_server: '{{ infra.datastores[ds1].server }}'
|
||||||
nfs_path: '{{ infra.datastores[ds1].path }}'
|
nfs_path: '{{ infra.datastores[ds1].path }}'
|
||||||
nfs_ro: '{{ infra.datastores[ds2].ro }}'
|
nfs_ro: '{{ infra.datastores[ds1].ro }}'
|
||||||
state: present
|
state: present
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
with_items: "{{ esxi_hosts }}"
|
with_items: "{{ esxi_hosts }}"
|
||||||
|
@ -19,7 +18,6 @@
|
||||||
hostname: '{{ item }}'
|
hostname: '{{ item }}'
|
||||||
username: '{{ esxi_user }}'
|
username: '{{ esxi_user }}'
|
||||||
password: '{{ esxi_password }}'
|
password: '{{ esxi_password }}'
|
||||||
esxi_hostname: '{{ item }}' # Won't be necessary with https://github.com/ansible/ansible/pull/56516
|
|
||||||
datastore_name: '{{ ds2 }}'
|
datastore_name: '{{ ds2 }}'
|
||||||
datastore_type: '{{ infra.datastores[ds2].type }}'
|
datastore_type: '{{ infra.datastores[ds2].type }}'
|
||||||
nfs_server: '{{ infra.datastores[ds2].server }}'
|
nfs_server: '{{ infra.datastores[ds2].server }}'
|
||||||
|
@ -37,7 +35,7 @@
|
||||||
password: '{{ vcenter_password }}'
|
password: '{{ vcenter_password }}'
|
||||||
cluster: '{{ ccr1 }}'
|
cluster: '{{ ccr1 }}'
|
||||||
register: setup_datastore_datatstore_facts
|
register: setup_datastore_datatstore_facts
|
||||||
failed_when: setup_datastore_datatstore_facts.datastores|length != 2
|
failed_when: setup_datastore_datatstore_facts.datastores|selectattr('type', 'equalto', 'NFS')|list|length != 2
|
||||||
until: setup_datastore_datatstore_facts is succeeded
|
until: setup_datastore_datatstore_facts is succeeded
|
||||||
retries: 60
|
retries: 60
|
||||||
delay: 1
|
delay: 1
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
username: '{{ vcenter_username }}'
|
username: '{{ vcenter_username }}'
|
||||||
password: '{{ vcenter_password }}'
|
password: '{{ vcenter_password }}'
|
||||||
datacenter: '{{ dc1 }}'
|
datacenter: '{{ dc1 }}'
|
||||||
cluster: '{{ cluster_name }}'
|
cluster: '{{ ccr1 }}'
|
||||||
resource_pool: DC0_C0_RP1
|
resource_pool: DC0_C0_RP1
|
||||||
mem_shares: normal
|
mem_shares: normal
|
||||||
mem_limit: -1
|
mem_limit: -1
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
scsi: paravirtual
|
scsi: paravirtual
|
||||||
cdrom:
|
cdrom:
|
||||||
type: iso
|
type: iso
|
||||||
iso_path: "[{{ ds1 }}] Fedora-Workstation-Live-x86_64-29-1.2.iso"
|
iso_path: "[{{ ds1 }}] fedora.iso"
|
||||||
networks:
|
networks:
|
||||||
- name: VM Network
|
- name: VM Network
|
||||||
with_items: '{{ virtual_machines }}'
|
with_items: '{{ virtual_machines }}'
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
scsi: paravirtual
|
scsi: paravirtual
|
||||||
cdrom:
|
cdrom:
|
||||||
type: iso
|
type: iso
|
||||||
iso_path: "[{{ ds1 }}] Fedora-Workstation-Live-x86_64-29-1.2.iso"
|
iso_path: "[{{ ds1 }}] fedora.iso"
|
||||||
networks:
|
networks:
|
||||||
- name: VM Network
|
- name: VM Network
|
||||||
with_items: '{{ virtual_machines_in_cluster }}'
|
with_items: '{{ virtual_machines_in_cluster }}'
|
||||||
|
|
|
@ -71,6 +71,20 @@
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
with_items: "{{ esxi_hosts }}"
|
with_items: "{{ esxi_hosts }}"
|
||||||
|
|
||||||
|
- name: Delete a datastore cluster to datacenter
|
||||||
|
vmware_datastore_cluster:
|
||||||
|
hostname: '{{ vcenter_hostname }}'
|
||||||
|
username: '{{ vcenter_username }}'
|
||||||
|
password: '{{ vcenter_password }}'
|
||||||
|
validate_certs: no
|
||||||
|
datacenter_name: "{{ dc1 }}"
|
||||||
|
datastore_cluster_name: '{{ item }}'
|
||||||
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- DSC1
|
||||||
|
- DSC2
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: Remove the datacenter
|
- name: Remove the datacenter
|
||||||
vmware_datacenter:
|
vmware_datacenter:
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
|
|
|
@ -7,24 +7,27 @@ f0: F0
|
||||||
switch1: switch1
|
switch1: switch1
|
||||||
dvswitch1: DVS0
|
dvswitch1: DVS0
|
||||||
# The ESXi entries in the inventory
|
# The ESXi entries in the inventory
|
||||||
|
vcenter_hostname: vcenter.test
|
||||||
|
vcenter_username: administrator@vsphere.local
|
||||||
|
vcenter_password: blablabla
|
||||||
esxi_hosts:
|
esxi_hosts:
|
||||||
- esxi-67-1.lab
|
- esxi1.test
|
||||||
- esxi-67-2.lab
|
- esxi2.test
|
||||||
esxi_user: root
|
esxi_user: root
|
||||||
esxi_password: "!234AaAa56"
|
esxi_password: balbalbla
|
||||||
esxi1: "{{ esxi_hosts[0] }}"
|
esxi1: "{{ esxi_hosts[0] }}"
|
||||||
esxi2: "{{ esxi_hosts[1] }}"
|
esxi2: "{{ esxi_hosts[1] }}"
|
||||||
infra:
|
infra:
|
||||||
datastores:
|
datastores:
|
||||||
LocalDS_0:
|
LocalDS_0:
|
||||||
type: nfs
|
type: nfs
|
||||||
server: 192.168.123.1
|
server: gateway.test
|
||||||
path: /srv/esx_lab/isos
|
path: /srv/share/isos
|
||||||
ro: true
|
ro: true
|
||||||
LocalDS_1:
|
LocalDS_1:
|
||||||
type: nfs
|
type: nfs
|
||||||
server: 192.168.123.1
|
server: gateway.test
|
||||||
path: /srv/esx_lab/vms
|
path: /srv/share/vms
|
||||||
ro: false
|
ro: false
|
||||||
virtual_machines:
|
virtual_machines:
|
||||||
- name: DC0_H0_VM0
|
- name: DC0_H0_VM0
|
||||||
|
|
|
@ -37,13 +37,25 @@
|
||||||
that:
|
that:
|
||||||
- not add_dsc.changed
|
- not add_dsc.changed
|
||||||
|
|
||||||
|
- name: Create a VM folder on given Datacenter
|
||||||
|
vcenter_folder:
|
||||||
|
hostname: '{{ vcenter_hostname }}'
|
||||||
|
username: '{{ vcenter_username }}'
|
||||||
|
password: '{{ vcenter_password }}'
|
||||||
|
datacenter: '{{ dc1 }}'
|
||||||
|
folder_name: 'my_datastore_folder'
|
||||||
|
folder_type: datastore
|
||||||
|
state: present
|
||||||
|
validate_certs: no
|
||||||
|
register: my_datastore_folder
|
||||||
|
|
||||||
- name: Add a datastore cluster using folder
|
- name: Add a datastore cluster using folder
|
||||||
vmware_datastore_cluster:
|
vmware_datastore_cluster:
|
||||||
hostname: '{{ vcenter_hostname }}'
|
hostname: '{{ vcenter_hostname }}'
|
||||||
username: '{{ vcenter_username }}'
|
username: '{{ vcenter_username }}'
|
||||||
password: '{{ vcenter_password }}'
|
password: '{{ vcenter_password }}'
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
folder: "/F0/{{ dc1 }}/datastore/F0"
|
folder: "{{ my_datastore_folder.result.path }}"
|
||||||
datastore_cluster_name: DSC2
|
datastore_cluster_name: DSC2
|
||||||
state: present
|
state: present
|
||||||
register: add_dsc_folder_check
|
register: add_dsc_folder_check
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
with_items: "{{ esxi_hosts }}"
|
with_items: "{{ esxi_hosts }}"
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "facts_from_esxi.results[0].datastores|length == 2"
|
- "facts_from_esxi.results[0].datastores|selectattr('type', 'equalto', 'NFS')|list|length == 2"
|
||||||
|
|
||||||
- name: get list of facts about datastores
|
- name: get list of facts about datastores
|
||||||
vmware_datastore_facts:
|
vmware_datastore_facts:
|
||||||
|
@ -47,8 +47,8 @@
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "facts_from_vcenter_with_dc_filter.datastores|length == 2"
|
- "facts_from_vcenter_with_dc_filter.datastores|selectattr('type', 'equalto', 'NFS')|list|length == 2"
|
||||||
- "facts_from_vcenter_with_no_filter.datastores|length == 2"
|
- "facts_from_vcenter_with_no_filter.datastores|selectattr('type', 'equalto', 'NFS')|list|length == 2"
|
||||||
- "facts_from_vcenter_with_no_filter.datastores[0]['capacity'] is defined"
|
- "facts_from_vcenter_with_no_filter.datastores[0]['capacity'] is defined"
|
||||||
|
|
||||||
# Testcase 0002: Get a full list of datastores in a cluster
|
# Testcase 0002: Get a full list of datastores in a cluster
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
disk:
|
disk:
|
||||||
- size_mb: 128
|
- size_mb: 128
|
||||||
type: thin
|
type: thin
|
||||||
datastore: LocalDS_0
|
datastore: "{{ ds2 }}"
|
||||||
cdrom:
|
cdrom:
|
||||||
type: iso
|
type: iso
|
||||||
iso_path: "[LocalDS_0] base.iso"
|
iso_path: "[{{ ds1 }}] centos.iso"
|
||||||
register: cdrom_vm
|
register: cdrom_vm
|
||||||
|
|
||||||
- debug: var=cdrom_vm
|
- debug: var=cdrom_vm
|
||||||
|
@ -39,10 +39,10 @@
|
||||||
password: "{{ vcenter_password }}"
|
password: "{{ vcenter_password }}"
|
||||||
folder: "vm"
|
folder: "vm"
|
||||||
name: CDROM-Test
|
name: CDROM-Test
|
||||||
datacenter: "{{ dc1 }}"
|
datastore: "{{ ds2 }}"
|
||||||
cdrom:
|
cdrom:
|
||||||
type: iso
|
type: iso
|
||||||
iso_path: "[LocalDS_0] base_new.iso"
|
iso_path: "[{{ ds1 }}] fedora.iso"
|
||||||
state: present
|
state: present
|
||||||
register: cdrom_vm
|
register: cdrom_vm
|
||||||
|
|
||||||
|
@ -117,16 +117,16 @@
|
||||||
disk:
|
disk:
|
||||||
- size_mb: 128
|
- size_mb: 128
|
||||||
type: thin
|
type: thin
|
||||||
datastore: LocalDS_0
|
datastore: "{{ ds2 }}"
|
||||||
- size_mb: 128
|
- size_mb: 128
|
||||||
type: thin
|
type: thin
|
||||||
datastore: LocalDS_0
|
datastore: "{{ ds2 }}"
|
||||||
- size_mb: 128
|
- size_mb: 128
|
||||||
type: thin
|
type: thin
|
||||||
datastore: LocalDS_0
|
datastore: "{{ ds2 }}"
|
||||||
cdrom:
|
cdrom:
|
||||||
type: iso
|
type: iso
|
||||||
iso_path: "[LocalDS_0] base.iso"
|
iso_path: "[{{ ds1 }}] fedora.iso"
|
||||||
register: cdrom_vm
|
register: cdrom_vm
|
||||||
|
|
||||||
- debug: var=cdrom_vm
|
- debug: var=cdrom_vm
|
||||||
|
@ -139,41 +139,40 @@
|
||||||
|
|
||||||
# VCSIM fails with invalidspec exception but real vCenter PASS testcase
|
# VCSIM fails with invalidspec exception but real vCenter PASS testcase
|
||||||
# Commenting this testcase till the time
|
# Commenting this testcase till the time
|
||||||
#- name: Again create VM with multiple disks and a CDROM - GitHub issue 38679
|
- when: vcsim is not defined
|
||||||
# vmware_guest:
|
block:
|
||||||
# validate_certs: False
|
- name: Again create VM with multiple disks and a CDROM - GitHub issue 38679
|
||||||
# hostname: "{{ vcenter_hostname }}"
|
vmware_guest:
|
||||||
# username: "{{ vcenter_username }}"
|
validate_certs: False
|
||||||
# password: "{{ vcenter_password }}"
|
hostname: "{{ vcenter_hostname }}"
|
||||||
# folder: "/{{ (clusters['json'][0]|basename).split('_')[0] }}/vm"
|
username: "{{ vcenter_username }}"
|
||||||
# name: CDROM-Test-38679
|
password: "{{ vcenter_password }}"
|
||||||
# datacenter: "{{ (clusters['json'][0]|basename).split('_')[0] }}"
|
folder: "{{ f0 }}"
|
||||||
# cluster: "{{ clusters['json'][0] }}"
|
name: CDROM-Test-38679
|
||||||
# resource_pool: Resources
|
datacenter: "{{ dc1 }}"
|
||||||
# guest_id: centos64Guest
|
cluster: "{{ ccr1 }}"
|
||||||
# hardware:
|
resource_pool: Resources
|
||||||
# memory_mb: 512
|
guest_id: centos64Guest
|
||||||
# num_cpus: 1
|
hardware:
|
||||||
# scsi: paravirtual
|
memory_mb: 512
|
||||||
# disk:
|
num_cpus: 1
|
||||||
# - size_mb: 128
|
scsi: paravirtual
|
||||||
# type: thin
|
disk:
|
||||||
# datastore: LocalDS_0
|
- size_mb: 128
|
||||||
# - size_mb: 128
|
type: thin
|
||||||
# type: thin
|
datastore: "{{ ds2 }}"
|
||||||
# datastore: LocalDS_0
|
- size_mb: 128
|
||||||
# - size_mb: 128
|
type: thin
|
||||||
# type: thin
|
datastore: "{{ ds2 }}"
|
||||||
# datastore: LocalDS_0
|
- size_mb: 128
|
||||||
# cdrom:
|
type: thin
|
||||||
# type: iso
|
datastore: "{{ ds2 }}"
|
||||||
# iso_path: "[LocalDS_0] base.iso"
|
cdrom:
|
||||||
# register: cdrom_vm
|
type: iso
|
||||||
|
iso_path: "[{{ ds1 }}] base.iso"
|
||||||
#- debug: var=cdrom_vm
|
register: cdrom_vm
|
||||||
|
- debug: var=cdrom_vm
|
||||||
#- name: assert the VM was created
|
- name: assert the VM was created
|
||||||
# assert:
|
assert:
|
||||||
# that:
|
that:
|
||||||
# - "cdrom_vm.failed == false"
|
- cdrom_vm is changed
|
||||||
# - "cdrom_vm.changed == false"
|
|
||||||
|
|
|
@ -2,34 +2,31 @@
|
||||||
# Copyright: (c) 2017, Abhijeet Kasurde <akasurde@redhat.com>
|
# 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)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
- when: vcsim is not defined
|
||||||
#- set_fact: vm1="{{ vmlist['json'][0] }}"
|
block:
|
||||||
#
|
- name: create new virtual machine with invalid guest id
|
||||||
#- name: create new virtual machine with invalid guest id
|
vmware_guest:
|
||||||
# vmware_guest:
|
validate_certs: False
|
||||||
# validate_certs: False
|
hostname: "{{ vcenter_hostname }}"
|
||||||
# hostname: "{{ vcenter_hostname }}"
|
username: "{{ vcenter_username }}"
|
||||||
# username: "{{ vcenter_username }}"
|
password: "{{ vcenter_password }}"
|
||||||
# password: "{{ vcenter_password }}"
|
name: invalid_vm
|
||||||
# name: "{{ 'invalid_vm_' + vm1 | basename }}"
|
guest_id: "invalid_guest_id"
|
||||||
# guest_id: "invalid_guest_id"
|
datacenter: "{{ dc1 }}"
|
||||||
# datacenter: "{{ (vm1|basename).split('_')[0] }}"
|
hardware:
|
||||||
# hardware:
|
num_cpus: 1
|
||||||
# num_cpus: 1
|
memory_mb: 512
|
||||||
# memory_mb: 512
|
disk:
|
||||||
# disk:
|
- size: 10gb
|
||||||
# - size: 0gb
|
type: thin
|
||||||
# type: thin
|
autoselect_datastore: True
|
||||||
# autoselect_datastore: True
|
state: present
|
||||||
# state: present
|
folder: "{{ f0 }}"
|
||||||
# folder: "{{ vm1 | dirname }}"
|
register: invalid_guest_0001_d1_c1_f0
|
||||||
# register: invalid_guest_0001_d1_c1_f0
|
ignore_errors: yes
|
||||||
# ignore_errors: yes
|
- debug: var=invalid_guest_0001_d1_c1_f0
|
||||||
#
|
- name: assert that changes were made
|
||||||
#- debug: var=invalid_guest_0001_d1_c1_f0
|
assert:
|
||||||
#
|
that:
|
||||||
#- name: assert that changes were made
|
- "not (invalid_guest_0001_d1_c1_f0 is changed)"
|
||||||
# assert:
|
- "'configSpec.guestId' in invalid_guest_0001_d1_c1_f0['msg']"
|
||||||
# that:
|
|
||||||
# - "invalid_guest_0001_d1_c1_f0['changed'] == false"
|
|
||||||
# - "'configSpec.guestId' in invalid_guest_0001_d1_c1_f0['msg']"
|
|
||||||
|
|
|
@ -88,8 +88,9 @@
|
||||||
setup_virtualmachines: true
|
setup_virtualmachines: true
|
||||||
- block:
|
- block:
|
||||||
- include: boot_firmware_d1_c1_f0.yml
|
- include: boot_firmware_d1_c1_f0.yml
|
||||||
- include: clone_with_convert.yml
|
# Failing, see: https://github.com/ansible/ansible/issues/57653
|
||||||
- include: clone_customize_guest_test.yml
|
# - include: clone_with_convert.yml
|
||||||
|
# - include: clone_customize_guest_test.yml
|
||||||
always:
|
always:
|
||||||
- name: Remove VM
|
- name: Remove VM
|
||||||
vmware_guest:
|
vmware_guest:
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
that:
|
that:
|
||||||
- "vm_result.changed"
|
- "vm_result.changed"
|
||||||
|
|
||||||
- name: Deploy VM {{ vm1 | basename }} again
|
- name: Deploy VM again
|
||||||
vmware_guest:
|
vmware_guest:
|
||||||
hostname: "{{ vcenter_hostname }}"
|
hostname: "{{ vcenter_hostname }}"
|
||||||
username: "{{ vcenter_username }}"
|
username: "{{ vcenter_username }}"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
disk:
|
disk:
|
||||||
- size_mb: 128
|
- size_mb: 128
|
||||||
type: thin
|
type: thin
|
||||||
datastore: LocalDS_0
|
datastore: "{{ ds2 }}"
|
||||||
register: vapp_vm
|
register: vapp_vm
|
||||||
|
|
||||||
- debug: var=vapp_vm
|
- debug: var=vapp_vm
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
hostname: "{{ vcenter_hostname }}"
|
hostname: "{{ vcenter_hostname }}"
|
||||||
username: "{{ vcenter_username }}"
|
username: "{{ vcenter_username }}"
|
||||||
password: "{{ vcenter_password }}"
|
password: "{{ vcenter_password }}"
|
||||||
folder: "/{{ (clusters['json'][0]|basename).split('_')[0] }}/vm"
|
folder: "{{ f0 }}"
|
||||||
name: vbs-Test
|
name: vbs-Test
|
||||||
datacenter: "{{ (clusters['json'][0]|basename).split('_')[0] }}"
|
datacenter: "{{ dc1 }}"
|
||||||
cluster: "{{ clusters['json'][0] }}"
|
cluster: "{{ ccr1 }}"
|
||||||
resource_pool: Resources
|
resource_pool: Resources
|
||||||
guest_id: windows9_64Guest
|
guest_id: windows9_64Guest
|
||||||
hardware:
|
hardware:
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
disk:
|
disk:
|
||||||
- size_mb: 128
|
- size_mb: 128
|
||||||
type: thin
|
type: thin
|
||||||
datastore: LocalDS_0
|
datastore: '{{ ds2 }}'
|
||||||
cdrom:
|
cdrom:
|
||||||
type: client
|
type: client
|
||||||
register: vbs_vm
|
register: vbs_vm
|
||||||
|
@ -39,10 +39,10 @@
|
||||||
hostname: "{{ vcenter_hostname }}"
|
hostname: "{{ vcenter_hostname }}"
|
||||||
username: "{{ vcenter_username }}"
|
username: "{{ vcenter_username }}"
|
||||||
password: "{{ vcenter_password }}"
|
password: "{{ vcenter_password }}"
|
||||||
folder: "/{{ (clusters['json'][0]|basename).split('_')[0] }}/vm"
|
folder: "{{ f0 }}"
|
||||||
name: vbs-Test2
|
name: vbs-Test2
|
||||||
datacenter: "{{ (clusters['json'][0]|basename).split('_')[0] }}"
|
datacenter: "{{ dc1 }}"
|
||||||
cluster: "{{ clusters['json'][0] }}"
|
cluster: "{{ ccr1 }}"
|
||||||
resource_pool: Resources
|
resource_pool: Resources
|
||||||
guest_id: windows9Server64Guest
|
guest_id: windows9Server64Guest
|
||||||
hardware:
|
hardware:
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
disk:
|
disk:
|
||||||
- size_mb: 128
|
- size_mb: 128
|
||||||
type: thin
|
type: thin
|
||||||
datastore: LocalDS_0
|
datastore: '{{ ds2 }}'
|
||||||
cdrom:
|
cdrom:
|
||||||
type: client
|
type: client
|
||||||
register: vbs_vm
|
register: vbs_vm
|
||||||
|
@ -73,13 +73,13 @@
|
||||||
hostname: "{{ vcenter_hostname }}"
|
hostname: "{{ vcenter_hostname }}"
|
||||||
username: "{{ vcenter_username }}"
|
username: "{{ vcenter_username }}"
|
||||||
password: "{{ vcenter_password }}"
|
password: "{{ vcenter_password }}"
|
||||||
folder: "/{{ (clusters['json'][0]|basename).split('_')[0] }}/vm"
|
folder: "{{ f0 }}"
|
||||||
name: vbs-Test2
|
name: vbs-Test2
|
||||||
datacenter: "{{ (clusters['json'][0]|basename).split('_')[0] }}"
|
datacenter: "{{ f0 }}"
|
||||||
disk:
|
disk:
|
||||||
- size_mb: 256
|
- size_mb: 256
|
||||||
type: thin
|
type: thin
|
||||||
datastore: LocalDS_0
|
datastore: '{{ ds2 }}'
|
||||||
hardware:
|
hardware:
|
||||||
virt_based_security: True
|
virt_based_security: True
|
||||||
state: present
|
state: present
|
||||||
|
@ -90,5 +90,4 @@
|
||||||
- name: assert the VM was changed
|
- name: assert the VM was changed
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "vbs_vm.failed == false"
|
- vbs_vm is changed
|
||||||
- "vbs_vm.changed == true"
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
datastore_type: '{{ infra.datastores[ds1].type }}'
|
datastore_type: '{{ infra.datastores[ds1].type }}'
|
||||||
nfs_server: '{{ infra.datastores[ds1].server }}'
|
nfs_server: '{{ infra.datastores[ds1].server }}'
|
||||||
nfs_path: '{{ infra.datastores[ds1].path }}'
|
nfs_path: '{{ infra.datastores[ds1].path }}'
|
||||||
nfs_ro: '{{ infra.datastores[ds2].ro }}'
|
nfs_ro: '{{ infra.datastores[ds1].ro }}'
|
||||||
state: present
|
state: present
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
datastore_type: '{{ infra.datastores[ds1].type }}'
|
datastore_type: '{{ infra.datastores[ds1].type }}'
|
||||||
nfs_server: '{{ infra.datastores[ds1].server }}'
|
nfs_server: '{{ infra.datastores[ds1].server }}'
|
||||||
nfs_path: '{{ infra.datastores[ds1].path }}'
|
nfs_path: '{{ infra.datastores[ds1].path }}'
|
||||||
nfs_ro: '{{ infra.datastores[ds2].ro }}'
|
nfs_ro: '{{ infra.datastores[ds1].ro }}'
|
||||||
state: present
|
state: present
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
datastore_type: '{{ infra.datastores[ds1].type }}'
|
datastore_type: '{{ infra.datastores[ds1].type }}'
|
||||||
nfs_server: '{{ infra.datastores[ds1].server }}'
|
nfs_server: '{{ infra.datastores[ds1].server }}'
|
||||||
nfs_path: '{{ infra.datastores[ds1].path }}'
|
nfs_path: '{{ infra.datastores[ds1].path }}'
|
||||||
nfs_ro: '{{ infra.datastores[ds2].ro }}'
|
nfs_ro: '{{ infra.datastores[ds1].ro }}'
|
||||||
state: present
|
state: present
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
register: mount_vmware_host_datastore
|
register: mount_vmware_host_datastore
|
||||||
|
|
|
@ -9,6 +9,16 @@
|
||||||
setup_attach_host: true
|
setup_attach_host: true
|
||||||
setup_datastore: true
|
setup_datastore: true
|
||||||
|
|
||||||
|
- name: First, set ipv6=0, for consistency
|
||||||
|
vmware_host_kernel_manager:
|
||||||
|
hostname: '{{ vcenter_hostname }}'
|
||||||
|
username: '{{ vcenter_username }}'
|
||||||
|
password: '{{ vcenter_password }}'
|
||||||
|
validate_certs: False
|
||||||
|
esxi_hostname: '{{ esxi1 }}'
|
||||||
|
kernel_module_name: "tcpip4"
|
||||||
|
kernel_module_option: "ipv6=0"
|
||||||
|
|
||||||
- name: host connected, module exists, options exist, arguments different
|
- name: host connected, module exists, options exist, arguments different
|
||||||
vmware_host_kernel_manager:
|
vmware_host_kernel_manager:
|
||||||
hostname: '{{ vcenter_hostname }}'
|
hostname: '{{ vcenter_hostname }}'
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
setup_datacenter: true
|
setup_datacenter: true
|
||||||
setup_attach_host: true
|
setup_attach_host: true
|
||||||
setup_cluster: true
|
setup_cluster: true
|
||||||
|
setup_switch: true
|
||||||
|
|
||||||
- name: Create portgroup without Portgroup and vSwitch
|
- name: Create portgroup without Portgroup and vSwitch
|
||||||
vmware_portgroup:
|
vmware_portgroup:
|
||||||
|
@ -44,7 +45,7 @@
|
||||||
hostname: '{{ vcenter_hostname }}'
|
hostname: '{{ vcenter_hostname }}'
|
||||||
username: '{{ vcenter_username }}'
|
username: '{{ vcenter_username }}'
|
||||||
password: '{{ vcenter_password }}'
|
password: '{{ vcenter_password }}'
|
||||||
vswitch: 'vSwitch_03'
|
vswitch: '{{ switch1 }}'
|
||||||
portgroup: 'pg_03'
|
portgroup: 'pg_03'
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
@ -59,7 +60,7 @@
|
||||||
hostname: '{{ vcenter_hostname }}'
|
hostname: '{{ vcenter_hostname }}'
|
||||||
username: '{{ vcenter_username }}'
|
username: '{{ vcenter_username }}'
|
||||||
password: '{{ vcenter_password }}'
|
password: '{{ vcenter_password }}'
|
||||||
vswitch: 'vSwitch_03'
|
vswitch: '{{ switch1 }}'
|
||||||
portgroup: 'pg_03'
|
portgroup: 'pg_03'
|
||||||
cluster_name: "{{ ccr1 }}"
|
cluster_name: "{{ ccr1 }}"
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
password: "{{ vcenter_password }}"
|
password: "{{ vcenter_password }}"
|
||||||
drs_rule_name: drs_rule_0001
|
drs_rule_name: drs_rule_0001
|
||||||
cluster_name: "{{ ccr1 }}"
|
cluster_name: "{{ ccr1 }}"
|
||||||
vms: "{{ infra.vm_list }}"
|
vms: "{{ virtual_machines | map(attribute='name') | list }}"
|
||||||
enabled: False
|
enabled: False
|
||||||
affinity_rule: False
|
affinity_rule: False
|
||||||
mandatory: False
|
mandatory: False
|
||||||
|
|
|
@ -10,7 +10,17 @@
|
||||||
setup_attach_host: true
|
setup_attach_host: true
|
||||||
|
|
||||||
# TODO: akasurde: VCSIM does not suport network manager system
|
# TODO: akasurde: VCSIM does not suport network manager system
|
||||||
# FIXME: Implement check-mode support
|
- name: Ensure the vswitch is not already here
|
||||||
|
vmware_vswitch:
|
||||||
|
validate_certs: no
|
||||||
|
hostname: '{{ item.host }}'
|
||||||
|
username: '{{ esxi_user }}'
|
||||||
|
password: '{{ esxi_password }}'
|
||||||
|
switch: '{{ item.switch }}'
|
||||||
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- {host: "{{ esxi1 }}", switch: "vmswitch_0001"}
|
||||||
|
- {host: "{{ esxi2 }}", switch: "vmswitch_0002"}
|
||||||
|
|
||||||
- name: Add a nic to a switch
|
- name: Add a nic to a switch
|
||||||
vmware_vswitch:
|
vmware_vswitch:
|
||||||
|
@ -19,9 +29,10 @@
|
||||||
password: '{{ esxi_password }}'
|
password: '{{ esxi_password }}'
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
switch: vmswitch_0001
|
switch: vmswitch_0001
|
||||||
nics: vnic_1
|
nics: vmnic1
|
||||||
state: present
|
state: present
|
||||||
register: add_nic_run
|
register: add_nic_run
|
||||||
|
- debug: var=add_nic_run
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- add_nic_run.changed == true
|
- add_nic_run.changed == true
|
||||||
|
@ -33,29 +44,13 @@
|
||||||
password: '{{ esxi_password }}'
|
password: '{{ esxi_password }}'
|
||||||
validate_certs: no
|
validate_certs: no
|
||||||
switch: vmswitch_0001
|
switch: vmswitch_0001
|
||||||
nics: vnic_1
|
nics: vmnic1
|
||||||
state: present
|
state: present
|
||||||
register: add_nic_again_run
|
register: add_nic_again_run
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- add_nic_again_run.changed == false
|
- add_nic_again_run.changed == false
|
||||||
|
|
||||||
- name: Remove a switch (check-mode)
|
|
||||||
vmware_vswitch:
|
|
||||||
hostname: '{{ esxi1 }}'
|
|
||||||
username: '{{ esxi_user }}'
|
|
||||||
password: '{{ esxi_password }}'
|
|
||||||
validate_certs: no
|
|
||||||
switch: vmswitch_0001
|
|
||||||
state: absent
|
|
||||||
check_mode: yes
|
|
||||||
register: remove_nic_check
|
|
||||||
# FIXME: Implement check-mode support
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- remove_nic_check.changed == true
|
|
||||||
|
|
||||||
# FIXME: Removing a switch fails
|
|
||||||
- name: Remove a switch
|
- name: Remove a switch
|
||||||
vmware_vswitch:
|
vmware_vswitch:
|
||||||
hostname: '{{ esxi1 }}'
|
hostname: '{{ esxi1 }}'
|
||||||
|
@ -67,24 +62,8 @@
|
||||||
register: remove_nic_run
|
register: remove_nic_run
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- remove_nic_run.changed == true
|
- remove_nic_run is changed
|
||||||
|
|
||||||
- name: Remove a switch again (check-mode)
|
|
||||||
vmware_vswitch:
|
|
||||||
hostname: '{{ esxi1 }}'
|
|
||||||
username: '{{ esxi_user }}'
|
|
||||||
password: '{{ esxi_password }}'
|
|
||||||
validate_certs: no
|
|
||||||
switch: vmswitch_0001
|
|
||||||
state: absent
|
|
||||||
check_mode: yes
|
|
||||||
register: remove_nic_again_check
|
|
||||||
# FIXME: Implement check-mode support
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- remove_nic_again_check_mode.changed == false
|
|
||||||
|
|
||||||
# FIXME: Removing a switch fails
|
|
||||||
- name: Remove a switch again
|
- name: Remove a switch again
|
||||||
vmware_vswitch:
|
vmware_vswitch:
|
||||||
hostname: '{{ esxi1 }}'
|
hostname: '{{ esxi1 }}'
|
||||||
|
@ -96,19 +75,19 @@
|
||||||
register: remove_nic_again_run
|
register: remove_nic_again_run
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- remove_nic_again_run.changed == false
|
- not (remove_nic_again_run is changed)
|
||||||
|
|
||||||
- name: Add vswitch to a specific host system
|
- name: Add vswitch to a specific host system
|
||||||
vmware_vswitch:
|
vmware_vswitch:
|
||||||
validate_certs: False
|
validate_certs: False
|
||||||
hostname: '{{ esxi1 }}'
|
hostname: '{{ vcenter_hostname }}'
|
||||||
username: '{{ esxi_user }}'
|
username: '{{ vcenter_username }}'
|
||||||
password: '{{ esxi_password }}'
|
password: '{{ vcenter_password }}'
|
||||||
switch: vmswitch_0002
|
switch: vmswitch_0002
|
||||||
nics: vnic_1
|
nics: vmnic1
|
||||||
esxi_hostname: guest1
|
esxi_hostname: '{{ esxi2 }}'
|
||||||
register: add_vswitch_with_host_system
|
register: add_vswitch_with_host_system
|
||||||
- debug: var=add_vswitch_with_host_system
|
- debug: var=add_vswitch_with_host_system
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- add_vswitch_with_host_system.changed == true
|
- add_vswitch_with_host_system is changed
|
||||||
|
|
Loading…
Reference in a new issue