mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
---
|
|
- when: vcsim is not defined
|
|
block:
|
|
- include_tasks: teardown.yml
|
|
|
|
- when: vcsim is not defined and setup_esxi_instance is not defined
|
|
block:
|
|
- include_tasks: setup_datacenter.yml
|
|
- include_tasks: setup_cluster.yml
|
|
- include_tasks: setup_attach_hosts.yml
|
|
when: setup_attach_host is defined
|
|
- include_tasks: setup_datastore.yml
|
|
when: setup_datastore is defined
|
|
- include_tasks: setup_virtualmachines.yml
|
|
when: setup_virtualmachines is defined
|
|
- include_tasks: setup_switch.yml
|
|
when: setup_switch is defined
|
|
|
|
|
|
- when: vcsim is defined
|
|
block:
|
|
|
|
- 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
|
|
|
|
- name: add the hosts in the inventory
|
|
add_host:
|
|
hostname: '{{ item | basename }}'
|
|
ansible_host: '{{ item | basename }}'
|
|
ansible_user: 'root'
|
|
ansible_password: 'pass'
|
|
groups:
|
|
- 'esxi-lab'
|
|
with_items: '{{ vcsim_host_list.json }}'
|
|
|
|
- debug:
|
|
var: vcsim_host_list
|
|
|
|
- set_fact:
|
|
vcenter_hostname: "{{ vcsim }}"
|
|
vcenter_username: "user"
|
|
vcenter_password: "pass"
|