2019-05-16 15:36:48 +02:00
|
|
|
---
|
|
|
|
- name: load vars
|
|
|
|
include_vars:
|
|
|
|
file: vcsim.yml
|
|
|
|
|
|
|
|
- name: kill vcsim
|
|
|
|
uri:
|
|
|
|
url: http://{{ vcsim }}:5000/killall
|
|
|
|
|
|
|
|
- name: start vcsim (all dressed)
|
|
|
|
uri:
|
|
|
|
url: http://{{ vcsim }}:5000/spawn?cluster=1&folder=1&ds=2
|
|
|
|
register: vcsim_instance
|
|
|
|
when: setup_esxi_instance is not defined
|
|
|
|
|
|
|
|
- name: start vcsim (ESXi only)
|
|
|
|
uri:
|
|
|
|
url: http://{{ vcsim }}:5000/spawn?esx=1
|
|
|
|
register: vcsim_instance
|
|
|
|
when: setup_esxi_instance is defined
|
|
|
|
|
|
|
|
# - name: get a list of Hosts from vcsim
|
|
|
|
# uri:
|
|
|
|
# url: http://{{ vcsim }}:5000/govc_find?filter=H
|
|
|
|
# register: vcsim_host_list
|
|
|
|
|
|
|
|
# - name: get a list of Hosts from vcsim
|
|
|
|
# uri:
|
|
|
|
# url: http://{{ vcsim }}:5000/govc_find?filter=F
|
|
|
|
# register: vcsim_host_folder
|
|
|
|
# - debug: var=vcsim_host_folder
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
vcenter_hostname: "{{ vcsim }}"
|
|
|
|
vcenter_username: "user"
|
|
|
|
vcenter_password: "pass"
|
2019-07-11 08:12:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
- name: set state to poweroff on all VMs
|
|
|
|
vmware_guest:
|
|
|
|
validate_certs: False
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
name: "{{ item.name }}"
|
|
|
|
state: poweredoff
|
|
|
|
with_items: "{{ virtual_machines + virtual_machines_in_cluster }}"
|
|
|
|
register: poweroff_d1_c1_f0
|