|
|
@ -2,44 +2,11 @@
|
|
|
|
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
|
|
|
|
# Copyright: (c) 2018, 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)
|
|
|
|
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
|
|
|
|
var: vcsim_instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Wait for vcsim server to come up online
|
|
|
|
|
|
|
|
wait_for:
|
|
|
|
|
|
|
|
host: "{{ vcsim }}"
|
|
|
|
|
|
|
|
port: 443
|
|
|
|
|
|
|
|
state: started
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: get datacenter
|
|
|
|
|
|
|
|
uri:
|
|
|
|
|
|
|
|
url: http://{{ vcsim }}:5000/govc_find?filter=DC
|
|
|
|
|
|
|
|
register: datacenters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: get a datacenter
|
|
|
|
|
|
|
|
set_fact:
|
|
|
|
|
|
|
|
dc1: "{{ datacenters.json[0] | basename }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create all types of folder in check mode
|
|
|
|
- name: Create all types of folder in check mode
|
|
|
|
vcenter_folder:
|
|
|
|
vcenter_folder:
|
|
|
|
hostname: "{{ vcsim }}"
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcsim_instance.json.username }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcsim_instance.json.password }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
validate_certs: no
|
|
|
|
validate_certs: no
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
folder_name: "{{ item }}_folder"
|
|
|
|
folder_name: "{{ item }}_folder"
|
|
|
@ -53,7 +20,8 @@
|
|
|
|
- network
|
|
|
|
- network
|
|
|
|
check_mode: yes
|
|
|
|
check_mode: yes
|
|
|
|
|
|
|
|
|
|
|
|
- debug: msg="{{ all_folder_results }}"
|
|
|
|
- debug:
|
|
|
|
|
|
|
|
msg: "{{ all_folder_results }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
@ -62,9 +30,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create all types of folder
|
|
|
|
- name: Create all types of folder
|
|
|
|
vcenter_folder:
|
|
|
|
vcenter_folder:
|
|
|
|
hostname: "{{ vcsim }}"
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcsim_instance.json.username }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcsim_instance.json.password }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
validate_certs: no
|
|
|
|
validate_certs: no
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
folder_name: "{{ item }}_folder"
|
|
|
|
folder_name: "{{ item }}_folder"
|
|
|
@ -77,7 +45,8 @@
|
|
|
|
- datastore
|
|
|
|
- datastore
|
|
|
|
- network
|
|
|
|
- network
|
|
|
|
|
|
|
|
|
|
|
|
- debug: msg="{{ all_folder_results }}"
|
|
|
|
- debug:
|
|
|
|
|
|
|
|
msg: "{{ all_folder_results }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
@ -86,9 +55,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create all types of sub folder in check mode
|
|
|
|
- name: Create all types of sub folder in check mode
|
|
|
|
vcenter_folder:
|
|
|
|
vcenter_folder:
|
|
|
|
hostname: "{{ vcsim }}"
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcsim_instance.json.username }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcsim_instance.json.password }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
validate_certs: no
|
|
|
|
validate_certs: no
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
folder_name: "sub_{{ item }}_folder"
|
|
|
|
folder_name: "sub_{{ item }}_folder"
|
|
|
@ -102,7 +71,8 @@
|
|
|
|
- network
|
|
|
|
- network
|
|
|
|
check_mode: yes
|
|
|
|
check_mode: yes
|
|
|
|
|
|
|
|
|
|
|
|
- debug: msg="{{ all_folder_results }}"
|
|
|
|
- debug:
|
|
|
|
|
|
|
|
msg: "{{ all_folder_results }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
@ -111,9 +81,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create all types of sub folder
|
|
|
|
- name: Create all types of sub folder
|
|
|
|
vcenter_folder:
|
|
|
|
vcenter_folder:
|
|
|
|
hostname: "{{ vcsim }}"
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcsim_instance.json.username }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcsim_instance.json.password }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
validate_certs: no
|
|
|
|
validate_certs: no
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
folder_name: "sub_{{ item }}_folder"
|
|
|
|
folder_name: "sub_{{ item }}_folder"
|
|
|
@ -128,9 +98,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: Recreate all types of sub folder
|
|
|
|
- name: Recreate all types of sub folder
|
|
|
|
vcenter_folder:
|
|
|
|
vcenter_folder:
|
|
|
|
hostname: "{{ vcsim }}"
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcsim_instance.json.username }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcsim_instance.json.password }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
validate_certs: no
|
|
|
|
validate_certs: no
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
folder_name: "sub_{{ item }}_folder"
|
|
|
|
folder_name: "sub_{{ item }}_folder"
|
|
|
@ -143,7 +113,8 @@
|
|
|
|
- datastore
|
|
|
|
- datastore
|
|
|
|
- network
|
|
|
|
- network
|
|
|
|
|
|
|
|
|
|
|
|
- debug: msg="{{ all_folder_results }}"
|
|
|
|
- debug:
|
|
|
|
|
|
|
|
msg: "{{ all_folder_results }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
@ -151,54 +122,55 @@
|
|
|
|
- all_folder_results.changed
|
|
|
|
- all_folder_results.changed
|
|
|
|
- not recreate_folders.changed
|
|
|
|
- not recreate_folders.changed
|
|
|
|
|
|
|
|
|
|
|
|
## Testcase: Delete Delete all types of folder
|
|
|
|
## Testcase: Delete all types of folder
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Doesn't work with vcsim. Looks like UnregisterAndDestroy isn't supported.
|
|
|
|
# Doesn't work with vcsim. Looks like UnregisterAndDestroy isn't supported.
|
|
|
|
#
|
|
|
|
- when: vcsim is not defined
|
|
|
|
# - name: Delete all types of folder
|
|
|
|
block:
|
|
|
|
# vcenter_folder:
|
|
|
|
- name: Delete all types of folder
|
|
|
|
# hostname: "{{ vcsim }}"
|
|
|
|
vcenter_folder:
|
|
|
|
# username: "{{ vcsim_instance.json.username }}"
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
# password: "{{ vcsim_instance.json.password }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
# validate_certs: no
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
# datacenter: "{{ dc1 }}"
|
|
|
|
validate_certs: no
|
|
|
|
# folder_name: "{{ item }}_folder"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
# folder_type: "{{ item }}"
|
|
|
|
folder_name: "{{ item }}_folder"
|
|
|
|
# state: absent
|
|
|
|
folder_type: "{{ item }}"
|
|
|
|
# register: all_folder_results
|
|
|
|
state: absent
|
|
|
|
# with_items:
|
|
|
|
register: all_folder_results
|
|
|
|
# - vm
|
|
|
|
with_items:
|
|
|
|
# - host
|
|
|
|
- vm
|
|
|
|
# - datastore
|
|
|
|
- host
|
|
|
|
# - network
|
|
|
|
- datastore
|
|
|
|
#
|
|
|
|
- network
|
|
|
|
# - debug: msg="{{ all_folder_results }}"
|
|
|
|
|
|
|
|
#
|
|
|
|
- debug: msg="{{ all_folder_results }}"
|
|
|
|
# - name: ensure everything for {{ dc1 }}
|
|
|
|
|
|
|
|
# assert:
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
# that:
|
|
|
|
assert:
|
|
|
|
# - all_folder_results.changed
|
|
|
|
that:
|
|
|
|
#
|
|
|
|
- all_folder_results.changed
|
|
|
|
# - name: Delete all types of folder again
|
|
|
|
|
|
|
|
# vcenter_folder:
|
|
|
|
- name: Delete all types of folder again
|
|
|
|
# hostname: "{{ vcsim }}"
|
|
|
|
vcenter_folder:
|
|
|
|
# username: "{{ vcsim_instance.json.username }}"
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
# password: "{{ vcsim_instance.json.password }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
# validate_certs: no
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
# datacenter: "{{ dc1 }}"
|
|
|
|
validate_certs: no
|
|
|
|
# folder_name: "{{ item }}_folder"
|
|
|
|
datacenter: "{{ dc1 }}"
|
|
|
|
# folder_type: "{{ item }}"
|
|
|
|
folder_name: "{{ item }}_folder"
|
|
|
|
# state: absent
|
|
|
|
folder_type: "{{ item }}"
|
|
|
|
# register: all_folder_results
|
|
|
|
state: absent
|
|
|
|
# with_items:
|
|
|
|
register: all_folder_results
|
|
|
|
# - vm
|
|
|
|
with_items:
|
|
|
|
# - host
|
|
|
|
- vm
|
|
|
|
# - datastore
|
|
|
|
- host
|
|
|
|
# - network
|
|
|
|
- datastore
|
|
|
|
#
|
|
|
|
- network
|
|
|
|
# - debug: msg="{{ all_folder_results }}"
|
|
|
|
|
|
|
|
#
|
|
|
|
- debug: msg="{{ all_folder_results }}"
|
|
|
|
# - name: ensure everything for {{ dc1 }}
|
|
|
|
|
|
|
|
# assert:
|
|
|
|
- name: ensure everything for {{ dc1 }}
|
|
|
|
# that:
|
|
|
|
assert:
|
|
|
|
# - not all_folder_results.changed
|
|
|
|
that:
|
|
|
|
|
|
|
|
- not all_folder_results.changed
|
|
|
|