2019-04-24 19:02:21 +02:00
|
|
|
---
|
2019-10-15 21:21:33 +02:00
|
|
|
|
|
|
|
- name: Clean up the firewall rules
|
|
|
|
vmware_host_firewall_manager:
|
|
|
|
cluster_name: '{{ ccr1 }}'
|
|
|
|
rules:
|
|
|
|
- name: vvold
|
|
|
|
enabled: False
|
|
|
|
- name: CIMHttpServer
|
|
|
|
enabled: True
|
|
|
|
allowed_hosts:
|
|
|
|
all_ip: True
|
|
|
|
- name: NFC
|
|
|
|
enabled: True
|
|
|
|
allowed_hosts:
|
|
|
|
all_ip: True
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2019-07-11 08:12:49 +02:00
|
|
|
- name: Remove the VM prepared by prepare_vmware_tests
|
2019-04-24 19:02:21 +02:00
|
|
|
vmware_guest:
|
2019-05-16 15:36:48 +02:00
|
|
|
name: "{{ item.name }}"
|
2019-04-24 19:02:21 +02:00
|
|
|
force: yes
|
|
|
|
state: absent
|
2019-05-16 15:36:48 +02:00
|
|
|
with_items: '{{ virtual_machines + virtual_machines_in_cluster }}'
|
2019-07-11 08:12:49 +02:00
|
|
|
|
|
|
|
- name: Remove the test_vm* VMs
|
|
|
|
vmware_guest:
|
|
|
|
name: "{{ item }}"
|
|
|
|
force: yes
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- test_vm1
|
|
|
|
- test_vm2
|
|
|
|
- test_vm3
|
2019-04-24 19:02:21 +02:00
|
|
|
|
2019-11-12 12:43:57 +01:00
|
|
|
- name: Remove the DVS portgroups
|
|
|
|
vmware_dvs_portgroup:
|
|
|
|
switch_name: "{{ dvswitch1 }}"
|
|
|
|
portgroup_name: '{{ item }}'
|
|
|
|
vlan_id: 0
|
|
|
|
num_ports: 32
|
|
|
|
portgroup_type: earlyBinding
|
|
|
|
state: absent
|
|
|
|
loop:
|
|
|
|
- DC0_DVPG0
|
|
|
|
- DVPG/1
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2019-04-24 19:02:21 +02:00
|
|
|
- name: Remove the DVSwitch
|
|
|
|
vmware_dvswitch:
|
|
|
|
datacenter_name: '{{ dc1 }}'
|
|
|
|
state: absent
|
2019-08-27 16:47:38 +02:00
|
|
|
switch_name: '{{ item }}'
|
|
|
|
loop:
|
|
|
|
- '{{ dvswitch1 }}'
|
|
|
|
- dvswitch_0001
|
|
|
|
- dvswitch_0002
|
2019-04-24 19:02:21 +02:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Remove the vSwitches
|
|
|
|
vmware_vswitch:
|
2019-05-13 20:12:21 +02:00
|
|
|
hostname: '{{ item }}'
|
2019-05-16 15:36:48 +02:00
|
|
|
username: '{{ esxi_user }}'
|
|
|
|
password: '{{ esxi_password }}'
|
2019-04-24 19:02:21 +02:00
|
|
|
switch_name: "{{ switch1 }}"
|
|
|
|
state: absent
|
2019-05-16 15:36:48 +02:00
|
|
|
with_items: "{{ esxi_hosts }}"
|
|
|
|
ignore_errors: yes
|
2019-04-24 19:02:21 +02:00
|
|
|
|
|
|
|
- name: Remove ESXi Hosts to vCenter
|
|
|
|
vmware_host:
|
|
|
|
datacenter_name: '{{ dc1 }}'
|
|
|
|
cluster_name: ccr1
|
2019-05-13 20:12:21 +02:00
|
|
|
esxi_hostname: '{{ item }}'
|
2019-05-16 15:36:48 +02:00
|
|
|
esxi_username: '{{ esxi_user }}'
|
|
|
|
esxi_password: '{{ esxi_password }}'
|
2019-04-24 19:02:21 +02:00
|
|
|
state: absent
|
2019-05-16 15:36:48 +02:00
|
|
|
with_items: "{{ esxi_hosts }}"
|
2019-04-24 19:02:21 +02:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: Umount NFS datastores to ESXi (1/2)
|
|
|
|
vmware_host_datastore:
|
2019-05-13 20:12:21 +02:00
|
|
|
hostname: '{{ item }}'
|
2019-05-16 15:36:48 +02:00
|
|
|
username: '{{ esxi_user }}'
|
|
|
|
password: '{{ esxi_password }}'
|
2019-11-13 16:37:31 +01:00
|
|
|
datastore_name: '{{ ro_datastore }}'
|
2019-04-24 19:02:21 +02:00
|
|
|
state: absent
|
2019-05-16 15:36:48 +02:00
|
|
|
with_items: "{{ esxi_hosts }}"
|
2019-04-24 19:02:21 +02:00
|
|
|
|
|
|
|
- name: Umount NFS datastores to ESXi (2/2)
|
|
|
|
vmware_host_datastore:
|
2019-05-13 20:12:21 +02:00
|
|
|
hostname: '{{ item }}'
|
2019-05-16 15:36:48 +02:00
|
|
|
username: '{{ esxi_user }}'
|
|
|
|
password: '{{ esxi_password }}'
|
2019-11-13 16:37:31 +01:00
|
|
|
datastore_name: '{{ rw_datastore }}'
|
2019-04-24 19:02:21 +02:00
|
|
|
state: absent
|
2019-05-16 15:36:48 +02:00
|
|
|
with_items: "{{ esxi_hosts }}"
|
2019-04-24 19:02:21 +02:00
|
|
|
|
2019-06-08 00:34:20 +02:00
|
|
|
- name: Delete a datastore cluster to datacenter
|
|
|
|
vmware_datastore_cluster:
|
|
|
|
datacenter_name: "{{ dc1 }}"
|
|
|
|
datastore_cluster_name: '{{ item }}'
|
|
|
|
state: absent
|
|
|
|
with_items:
|
|
|
|
- DSC1
|
|
|
|
- DSC2
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2019-04-24 19:02:21 +02:00
|
|
|
- name: Remove the datacenter
|
|
|
|
vmware_datacenter:
|
|
|
|
datacenter_name: '{{ item }}'
|
|
|
|
state: absent
|
|
|
|
when: vcsim is not defined
|
|
|
|
with_items:
|
|
|
|
- '{{ dc1 }}'
|
|
|
|
- datacenter_0001
|
|
|
|
|
|
|
|
- name: kill vcsim
|
|
|
|
uri:
|
|
|
|
url: "http://{{ vcsim }}:5000/killall"
|
|
|
|
when: vcsim is defined
|