mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
4b99a2ac50
The use of the `hostvars[esxi1].ansible_host` was attempt to use different hostname and IP address. But it's actually the source of more problems. VMware expects to be able to resolvable the host name. This means, that if someone wants to run the test-suite, s/he needs to use a DNS or update the `/etc/hosts` files on the different hosts.
65 lines
1.8 KiB
YAML
65 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
|
|
- include_tasks: setup_dvswitch.yml
|
|
when: setup_dvswitch 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 }}'
|
|
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"
|