1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

vmware: use hostname in esxi_hostname

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.
This commit is contained in:
Gonéri Le Bouder 2019-05-13 14:12:21 -04:00
parent eefc90b66f
commit 4b99a2ac50
35 changed files with 97 additions and 100 deletions

View file

@ -52,9 +52,6 @@
- name: add the hosts in the inventory - name: add the hosts in the inventory
add_host: add_host:
hostname: '{{ item | basename }}' hostname: '{{ item | basename }}'
ansible_host: '{{ item | basename }}'
ansible_user: 'root'
ansible_password: 'pass'
groups: groups:
- 'esxi-lab' - 'esxi-lab'
with_items: '{{ vcsim_host_list.json }}' with_items: '{{ vcsim_host_list.json }}'

View file

@ -5,7 +5,7 @@
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
datacenter_name: '{{ dc1 }}' datacenter_name: '{{ dc1 }}'
cluster_name: '{{ ccr1 }}' cluster_name: '{{ ccr1 }}'
esxi_hostname: '{{ hostvars[item].ansible_host }}' esxi_hostname: '{{ item }}'
esxi_username: '{{ hostvars[item].ansible_user }}' esxi_username: '{{ hostvars[item].ansible_user }}'
esxi_password: '{{ hostvars[item].ansible_password }}' esxi_password: '{{ hostvars[item].ansible_password }}'
state: present state: present
@ -18,6 +18,6 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[item].ansible_host }}' esxi_hostname: '{{ item }}'
state: absent state: absent
with_items: "{{ groups['esxi-lab'] }}" with_items: "{{ groups['esxi-lab'] }}"

View file

@ -2,7 +2,7 @@
- debug: var=datastores - debug: var=datastores
- name: Mount NFS (ds1) datastores to ESXi - name: Mount NFS (ds1) datastores to ESXi
vmware_host_datastore: vmware_host_datastore:
hostname: '{{ hostvars[item].ansible_host }}' hostname: '{{ item }}'
username: '{{ hostvars[item].ansible_user }}' username: '{{ hostvars[item].ansible_user }}'
password: '{{ hostvars[item].ansible_password }}' password: '{{ hostvars[item].ansible_password }}'
datastore_name: '{{ ds1 }}' datastore_name: '{{ ds1 }}'
@ -10,14 +10,14 @@
nfs_server: '{{ infra.datastores[ds1].server }}' nfs_server: '{{ infra.datastores[ds1].server }}'
nfs_path: '{{ infra.datastores[ds1].path }}' nfs_path: '{{ infra.datastores[ds1].path }}'
nfs_ro: '{{ infra.datastores[ds2].ro }}' nfs_ro: '{{ infra.datastores[ds2].ro }}'
esxi_hostname: '{{ hostvars[item].ansible_host }}' esxi_hostname: '{{ item }}'
state: present state: present
validate_certs: no validate_certs: no
with_items: "{{ groups['esxi-lab'] }}" with_items: "{{ groups['esxi-lab'] }}"
- name: Mount NFS (ds2) datastores on the ESXi - name: Mount NFS (ds2) datastores on the ESXi
vmware_host_datastore: vmware_host_datastore:
hostname: '{{ hostvars[item].ansible_host }}' hostname: '{{ item }}'
username: '{{ hostvars[item].ansible_user }}' username: '{{ hostvars[item].ansible_user }}'
password: '{{ hostvars[item].ansible_password }}' password: '{{ hostvars[item].ansible_password }}'
datastore_name: '{{ ds2 }}' datastore_name: '{{ ds2 }}'
@ -25,7 +25,7 @@
nfs_server: '{{ infra.datastores[ds2].server }}' nfs_server: '{{ infra.datastores[ds2].server }}'
nfs_path: '{{ infra.datastores[ds2].path }}' nfs_path: '{{ infra.datastores[ds2].path }}'
nfs_ro: '{{ infra.datastores[ds2].ro }}' nfs_ro: '{{ infra.datastores[ds2].ro }}'
esxi_hostname: '{{ hostvars[item].ansible_host }}' esxi_hostname: '{{ item }}'
state: present state: present
validate_certs: no validate_certs: no
with_items: "{{ groups['esxi-lab'] }}" with_items: "{{ groups['esxi-lab'] }}"

View file

@ -26,7 +26,7 @@
- name: Remove the vSwitches - name: Remove the vSwitches
vmware_vswitch: vmware_vswitch:
validate_certs: no validate_certs: no
hostname: '{{ hostvars[item].ansible_host }}' hostname: '{{ item }}'
username: '{{ hostvars[item].ansible_user }}' username: '{{ hostvars[item].ansible_user }}'
password: '{{ hostvars[item].ansible_password }}' password: '{{ hostvars[item].ansible_password }}'
switch_name: "{{ switch1 }}" switch_name: "{{ switch1 }}"
@ -40,7 +40,7 @@
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
datacenter_name: '{{ dc1 }}' datacenter_name: '{{ dc1 }}'
cluster_name: ccr1 cluster_name: ccr1
esxi_hostname: '{{ hostvars[item].ansible_host }}' esxi_hostname: '{{ item }}'
esxi_username: '{{ hostvars[item].ansible_user }}' esxi_username: '{{ hostvars[item].ansible_user }}'
esxi_password: '{{ hostvars[item].ansible_password }}' esxi_password: '{{ hostvars[item].ansible_password }}'
state: absent state: absent
@ -60,7 +60,7 @@
- name: Umount NFS datastores to ESXi (1/2) - name: Umount NFS datastores to ESXi (1/2)
vmware_host_datastore: vmware_host_datastore:
hostname: '{{ hostvars[item].ansible_host }}' hostname: '{{ item }}'
username: '{{ hostvars[item].ansible_user }}' username: '{{ hostvars[item].ansible_user }}'
password: '{{ hostvars[item].ansible_password }}' password: '{{ hostvars[item].ansible_password }}'
datastore_name: '{{ ds1 }}' datastore_name: '{{ ds1 }}'
@ -76,7 +76,7 @@
- name: Umount NFS datastores to ESXi (2/2) - name: Umount NFS datastores to ESXi (2/2)
vmware_host_datastore: vmware_host_datastore:
hostname: '{{ hostvars[item].ansible_host }}' hostname: '{{ item }}'
username: '{{ hostvars[item].ansible_user }}' username: '{{ hostvars[item].ansible_user }}'
password: '{{ hostvars[item].ansible_password }}' password: '{{ hostvars[item].ansible_password }}'
datastore_name: '{{ ds2 }}' datastore_name: '{{ ds2 }}'
@ -93,7 +93,7 @@
# - name: get a final list of the datastore # - name: get a final list of the datastore
# vmware_datastore_facts: # vmware_datastore_facts:
# validate_certs: False # validate_certs: False
# hostname: '{{ hostvars[item].ansible_host }}' # hostname: '{{ item }}'
# username: '{{ hostvars[item].ansible_user }}' # username: '{{ hostvars[item].ansible_user }}'
# password: '{{ hostvars[item].ansible_password }}' # password: '{{ hostvars[item].ansible_password }}'
# register: datastore_facts # register: datastore_facts

View file

@ -164,7 +164,7 @@
#template: "{{ item|basename }}" #template: "{{ item|basename }}"
guest_id: centos64Guest guest_id: centos64Guest
datacenter: "{{ dc1 }}" datacenter: "{{ dc1 }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
hardware: hardware:
num_cpus: 1 num_cpus: 1
memory_mb: 512 memory_mb: 512

View file

@ -12,7 +12,7 @@
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
datacenter_name: '{{ dc1 }}' datacenter_name: '{{ dc1 }}'
cluster_name: '{{ ccr1 }}' cluster_name: '{{ ccr1 }}'
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
esxi_username: '{{ hostvars[esxi1].ansible_user }}' esxi_username: '{{ hostvars[esxi1].ansible_user }}'
esxi_password: '{{ hostvars[esxi1].ansible_password }}' esxi_password: '{{ hostvars[esxi1].ansible_password }}'
state: present state: present
@ -26,7 +26,7 @@
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
datacenter_name: '{{ dc1 }}' datacenter_name: '{{ dc1 }}'
cluster_name: '{{ ccr1 }}' cluster_name: '{{ ccr1 }}'
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
esxi_username: '{{ hostvars[esxi1].ansible_user }}' esxi_username: '{{ hostvars[esxi1].ansible_user }}'
esxi_password: '{{ hostvars[esxi1].ansible_password }}' esxi_password: '{{ hostvars[esxi1].ansible_password }}'
state: present state: present
@ -44,7 +44,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
esxi_username: '{{ hostvars[esxi2].ansible_user }}' esxi_username: '{{ hostvars[esxi2].ansible_user }}'
esxi_password: '{{ hostvars[esxi2].ansible_password }}' esxi_password: '{{ hostvars[esxi2].ansible_password }}'
datacenter_name: "{{ dc1 }}" datacenter_name: "{{ dc1 }}"
@ -65,7 +65,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
datacenter_name: "{{ dc1 }}" datacenter_name: "{{ dc1 }}"
cluster_name: "{{ ccr1 }}" cluster_name: "{{ ccr1 }}"
fetch_ssl_thumbprint: False fetch_ssl_thumbprint: False
@ -77,7 +77,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
datacenter_name: "{{ dc1 }}" datacenter_name: "{{ dc1 }}"
cluster_name: "{{ ccr1 }}" cluster_name: "{{ ccr1 }}"
state: absent state: absent
@ -118,7 +118,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
esxi_username: '{{ hostvars[esxi2].ansible_user }}' esxi_username: '{{ hostvars[esxi2].ansible_user }}'
esxi_password: '{{ hostvars[esxi2].ansible_password }}' esxi_password: '{{ hostvars[esxi2].ansible_password }}'
datacenter_name: "{{ dc1 }}" datacenter_name: "{{ dc1 }}"
@ -138,7 +138,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
esxi_username: '{{ hostvars[esxi2].ansible_user }}' esxi_username: '{{ hostvars[esxi2].ansible_user }}'
esxi_password: '{{ hostvars[esxi2].ansible_password }}' esxi_password: '{{ hostvars[esxi2].ansible_password }}'
datacenter_name: "{{ dc1 }}" datacenter_name: "{{ dc1 }}"
@ -157,7 +157,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
esxi_username: '{{ hostvars[esxi2].ansible_user }}' esxi_username: '{{ hostvars[esxi2].ansible_user }}'
esxi_password: '{{ hostvars[esxi2].ansible_password }}' esxi_password: '{{ hostvars[esxi2].ansible_password }}'
datacenter_name: "{{ dc1 }}" datacenter_name: "{{ dc1 }}"

View file

@ -15,7 +15,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
acceptance_level: vmware_certified acceptance_level: vmware_certified
state: present state: present
@ -30,7 +30,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
acceptance_level: vmware_certified acceptance_level: vmware_certified
state: present state: present

View file

@ -13,7 +13,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
ad_domain: '{{ active_directory_domain }}' ad_domain: '{{ active_directory_domain }}'
ad_user: '{{ active_directory_user }}' ad_user: '{{ active_directory_user }}'
ad_password: '{{ active_directory_password }}' ad_password: '{{ active_directory_password }}'
@ -34,7 +34,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
ad_domain: example.local ad_domain: example.local
ad_user: adjoin ad_user: adjoin
ad_password: Password123$ ad_password: Password123$
@ -55,7 +55,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
ad_state: absent ad_state: absent
validate_certs: no validate_certs: no
register: host_active_directory_facts_2_check_mode register: host_active_directory_facts_2_check_mode
@ -73,7 +73,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
ad_state: absent ad_state: absent
validate_certs: no validate_certs: no
register: host_active_directory_facts_2 register: host_active_directory_facts_2

View file

@ -30,7 +30,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: False validate_certs: False
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
register: capability_0002_results register: capability_0002_results
- assert: - assert:
that: that:

View file

@ -46,7 +46,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: "{{ hostvars[esxi1].ansible_host }}" esxi_hostname: "{{ esxi1 }}"
register: single_hosts_result_check_mode register: single_hosts_result_check_mode
check_mode: yes check_mode: yes
- name: ensure facts are gathered for all hosts - name: ensure facts are gathered for all hosts
@ -60,7 +60,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: "{{ hostvars[esxi1].ansible_host }}" esxi_hostname: "{{ esxi1 }}"
register: single_hosts_result register: single_hosts_result
- name: ensure facts are gathered for all hosts - name: ensure facts are gathered for all hosts
assert: assert:

View file

@ -42,7 +42,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
options: options:
'Config.HostAgent.log.level': 'info' 'Config.HostAgent.log.level': 'info'
validate_certs: no validate_certs: no
@ -77,7 +77,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
options: options:
'Config.HostAgent.log.level': 'info' 'Config.HostAgent.log.level': 'info'
validate_certs: no validate_certs: no

View file

@ -27,7 +27,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: all_hosts_dns_result register: all_hosts_dns_result
@ -58,7 +58,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: all_hosts_dns_result_check_mode register: all_hosts_dns_result_check_mode
check_mode: yes check_mode: yes

View file

@ -10,7 +10,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
register: facts register: facts
- debug: var=facts - debug: var=facts
- name: verify some data,like ansible_processor - name: verify some data,like ansible_processor
@ -22,7 +22,7 @@
- name: get host facts through from a host - name: get host facts through from a host
vmware_host_facts: vmware_host_facts:
validate_certs: False validate_certs: False
hostname: '{{ hostvars[esxi1].ansible_host }}' hostname: '{{ esxi1 }}'
username: '{{ hostvars[esxi1].ansible_user }}' username: '{{ hostvars[esxi1].ansible_user }}'
password: '{{ hostvars[esxi1].ansible_password }}' password: '{{ hostvars[esxi1].ansible_password }}'
register: facts register: facts

View file

@ -48,7 +48,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
register: capability_0002_results register: capability_0002_results
- debug: var=capability_0002_results - debug: var=capability_0002_results
@ -65,7 +65,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
register: capability_0002_results register: capability_0002_results
check_mode: yes check_mode: yes

View file

@ -12,7 +12,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
register: firewall_0004_results register: firewall_0004_results
check_mode: yes check_mode: yes
@ -49,7 +49,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
register: firewall_0002_results register: firewall_0002_results
- assert: - assert:

View file

@ -44,8 +44,8 @@
- all_hosts_result.rule_set_state[item]['vvold']['desired_state'] == True - all_hosts_result.rule_set_state[item]['vvold']['desired_state'] == True
- all_hosts_result.rule_set_state[item]['vvold']['previous_state'] == False - all_hosts_result.rule_set_state[item]['vvold']['previous_state'] == False
with_items: with_items:
- '{{ hostvars[esxi1].ansible_host }}' - '{{ esxi1 }}'
- '{{ hostvars[esxi2].ansible_host }}' - '{{ esxi2 }}'
- name: Disable vvold for {{ host1 }} - name: Disable vvold for {{ host1 }}
vmware_host_firewall_manager: vmware_host_firewall_manager:
@ -53,7 +53,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
rules: rules:
- name: vvold - name: vvold
enabled: False enabled: False
@ -72,7 +72,7 @@
- host_result.rule_set_state[item]['vvold']['desired_state'] == False - host_result.rule_set_state[item]['vvold']['desired_state'] == False
- host_result.rule_set_state[item]['vvold']['previous_state'] == True - host_result.rule_set_state[item]['vvold']['previous_state'] == True
with_items: with_items:
- '{{ hostvars[esxi1].ansible_host }}' - '{{ esxi1 }}'
- name: Enable vvold rule set on all hosts of {{ ccr1 }} in check mode - name: Enable vvold rule set on all hosts of {{ ccr1 }} in check mode
vmware_host_firewall_manager: vmware_host_firewall_manager:
@ -96,9 +96,9 @@
- name: ensure facts are gathered for all hosts of {{ ccr1 }} - name: ensure facts are gathered for all hosts of {{ ccr1 }}
assert: assert:
that: that:
- all_hosts_result_check_mode.rule_set_state[hostvars[esxi1].ansible_host]['vvold']['current_state'] == True - all_hosts_result_check_mode.rule_set_state[esxi1]['vvold']['current_state'] == True
- all_hosts_result_check_mode.rule_set_state[hostvars[esxi2].ansible_host]['vvold']['current_state'] == True - all_hosts_result_check_mode.rule_set_state[esxi2]['vvold']['current_state'] == True
- all_hosts_result_check_mode.rule_set_state[hostvars[esxi2].ansible_host]['vvold']['desired_state'] == True - all_hosts_result_check_mode.rule_set_state[esxi2]['vvold']['desired_state'] == True
- name: Disable vvold for {{ host1 }} in check mode - name: Disable vvold for {{ host1 }} in check mode
vmware_host_firewall_manager: vmware_host_firewall_manager:
@ -106,7 +106,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
rules: rules:
- name: vvold - name: vvold
enabled: False enabled: False
@ -126,4 +126,4 @@
- host_result_check_mode.rule_set_state[item]['vvold']['desired_state'] == False - host_result_check_mode.rule_set_state[item]['vvold']['desired_state'] == False
- host_result_check_mode.rule_set_state[item]['vvold']['previous_state'] == False - host_result_check_mode.rule_set_state[item]['vvold']['previous_state'] == False
with_items: with_items:
- '{{ hostvars[esxi1].ansible_host }}' - '{{ esxi1 }}'

View file

@ -27,7 +27,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
state: disabled state: disabled
register: host_hyperthreading_facts register: host_hyperthreading_facts
@ -44,7 +44,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
state: disabled state: disabled
register: host_hyperthreading_facts_check_mode register: host_hyperthreading_facts_check_mode

View file

@ -23,7 +23,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
state: enabled state: enabled
register: host_ipv6_facts register: host_ipv6_facts
@ -38,7 +38,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
state: enabled state: enabled
register: host_ipv6_facts_check_mode register: host_ipv6_facts_check_mode

View file

@ -15,7 +15,7 @@
username: '{{ vcenter_username }}' username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
validate_certs: False validate_certs: False
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
kernel_module_name: "tcpip4" kernel_module_name: "tcpip4"
kernel_module_option: "ipv6=0" kernel_module_option: "ipv6=0"
register: my_results_01 register: my_results_01
@ -23,8 +23,8 @@
- name: Check that the provided kernel_module_name has kernel_module_option set - name: Check that the provided kernel_module_name has kernel_module_option set
assert: assert:
that: that:
- "'original_options' in my_results_01['ansible_module_results']['{{ hostvars[esxi1].ansible_host }}']" - "'original_options' in my_results_01['ansible_module_results']['{{ esxi1 }}']"
- "my_results_01['ansible_module_results']['{{ hostvars[esxi1].ansible_host }}'].original_options == 'ipv6=0'" - "my_results_01['ansible_module_results']['{{ esxi1 }}'].original_options == 'ipv6=0'"
- name: host connected, module exists, same options for idempotence test - name: host connected, module exists, same options for idempotence test
vmware_host_kernel_manager: vmware_host_kernel_manager:
@ -32,7 +32,7 @@
username: '{{ vcenter_username }}' username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}' password: '{{ vcenter_password }}'
validate_certs: False validate_certs: False
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
kernel_module_name: "tcpip4" kernel_module_name: "tcpip4"
kernel_module_option: "ipv6=0" kernel_module_option: "ipv6=0"
register: my_results_02 register: my_results_02

View file

@ -15,7 +15,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
state: present state: present
ntp_servers: ntp_servers:
- 0.pool.ntp.org - 0.pool.ntp.org
@ -28,7 +28,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
state: present state: present
ntp_servers: ntp_servers:
- 1.pool.ntp.org - 1.pool.ntp.org
@ -41,7 +41,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
state: absent state: absent
ntp_servers: ntp_servers:
- 1.pool.ntp.org - 1.pool.ntp.org
@ -54,7 +54,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
state: present state: present
ntp_servers: ntp_servers:
- 1.pool.ntp.org - 1.pool.ntp.org
@ -67,7 +67,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
state: present state: present
ntp_servers: ntp_servers:
- 2.pool.ntp.org - 2.pool.ntp.org
@ -82,7 +82,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
state: absent state: absent
ntp_servers: ntp_servers:
- 0.pool.ntp.org - 0.pool.ntp.org
@ -100,7 +100,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
ntp_servers: ntp_servers:
- 0.pool.ntp.org - 0.pool.ntp.org
- 1.pool.ntp.org - 1.pool.ntp.org
@ -114,7 +114,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
ntp_servers: ntp_servers:
- 3.pool.ntp.org - 3.pool.ntp.org
- 4.pool.ntp.org - 4.pool.ntp.org
@ -129,7 +129,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
state: present state: present
ntp_servers: ntp_servers:
- 0.pool.ntp.org - 0.pool.ntp.org
@ -143,7 +143,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
state: absent state: absent
ntp_servers: ntp_servers:
- 0.pool.ntp.org - 0.pool.ntp.org
@ -157,7 +157,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
ntp_servers: ntp_servers:
- 0.pool.ntp.org - 0.pool.ntp.org
- 1.pool.ntp.org - 1.pool.ntp.org

View file

@ -15,7 +15,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: host_ntp register: host_ntp
- debug: var=host_ntp - debug: var=host_ntp

View file

@ -15,7 +15,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: host_packages register: host_packages
- debug: var=host_packages - debug: var=host_packages

View file

@ -15,7 +15,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
policy: high-performance policy: high-performance
validate_certs: no validate_certs: no
register: host_result register: host_result
@ -23,7 +23,7 @@
- name: Ensure Power Management Policy for esxi1 - name: Ensure Power Management Policy for esxi1
assert: assert:
that: that:
- host_result.result['{{ hostvars[esxi1].ansible_host }}'].current_state == "high-performance" - host_result.result['{{ esxi1 }}'].current_state == "high-performance"
- name: Set the Power Management Policy on all hosts of {{ ccr1 }} - name: Set the Power Management Policy on all hosts of {{ ccr1 }}
vmware_host_powermgmt_policy: vmware_host_powermgmt_policy:
@ -46,7 +46,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
policy: high-performance policy: high-performance
validate_certs: no validate_certs: no
register: host_result register: host_result
@ -73,5 +73,5 @@
assert: assert:
that: that:
- not (all_hosts_result is changed) - not (all_hosts_result is changed)
- "all_hosts_result.result['{{ hostvars[esxi1].ansible_host }}']current_state == 'balanced'" - "all_hosts_result.result['{{ esxi1 }}']current_state == 'balanced'"
- "all_hosts_result.result['{{ hostvars[esxi2].ansible_host }}']current_state == 'balanced'" - "all_hosts_result.result['{{ esxi2 }}']current_state == 'balanced'"

View file

@ -23,7 +23,7 @@
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: False validate_certs: False
state: power-down-to-standby state: power-down-to-standby
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
force: True force: True
register: host_powerstate register: host_powerstate

View file

@ -16,7 +16,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: host_services register: host_services

View file

@ -29,7 +29,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
service_name: ntpd service_name: ntpd
state: absent state: absent
register: single_hosts_result register: single_hosts_result
@ -60,7 +60,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
service_name: ntpd service_name: ntpd
state: absent state: absent
register: single_hosts_result_check_mode register: single_hosts_result_check_mode

View file

@ -12,7 +12,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: ssl_facts register: ssl_facts
@ -42,7 +42,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
check_mode: yes check_mode: yes
register: ssl_facts register: ssl_facts

View file

@ -16,7 +16,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: host_vmhbas register: host_vmhbas

View file

@ -15,7 +15,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: host_vmnics register: host_vmnics
- debug: var=host_vmnics - debug: var=host_vmnics
@ -28,7 +28,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
capabilities: true capabilities: true
directpath_io: true directpath_io: true

View file

@ -13,7 +13,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
state: present state: present
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
validate_certs: no validate_certs: no
register: test_result_0001 register: test_result_0001
@ -30,7 +30,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
state: present state: present
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
validate_certs: no validate_certs: no
register: test_result_0002 register: test_result_0002
@ -47,7 +47,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
state: absent state: absent
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
validate_certs: no validate_certs: no
register: test_result_0003 register: test_result_0003
@ -64,7 +64,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
state: absent state: absent
esxi_hostname: '{{ hostvars[esxi2].ansible_host }}' esxi_hostname: '{{ esxi2 }}'
validate_certs: no validate_certs: no
register: test_result_0004 register: test_result_0004

View file

@ -27,7 +27,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
register: portgroup_0002_results register: portgroup_0002_results
- assert: - assert:
@ -41,7 +41,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
policies: true policies: true
register: portgroup_0003_results register: portgroup_0003_results
@ -56,7 +56,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: no validate_certs: no
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
policies: true policies: true
register: portgroup_0004_results register: portgroup_0004_results
check_mode: yes check_mode: yes

View file

@ -29,7 +29,7 @@
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
validate_certs: False validate_certs: False
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
register: target_0002_results register: target_0002_results
- assert: - assert:

View file

@ -29,7 +29,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
vswitch: "{{ switch1 }}" vswitch: "{{ switch1 }}"
portgroup: vMotion portgroup: vMotion
mtu: 9000 mtu: 9000
@ -55,7 +55,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
vswitch: "{{ switch1 }}" vswitch: "{{ switch1 }}"
device: '{{ host_vmkernel.device }}' device: '{{ host_vmkernel.device }}'
portgroup: vMotion portgroup: vMotion

View file

@ -15,7 +15,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: host_vmkernel register: host_vmkernel
- debug: var=host_vmkernel - debug: var=host_vmkernel
@ -28,7 +28,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: host_vmkernel_check_mode register: host_vmkernel_check_mode
check_mode: yes check_mode: yes

View file

@ -14,7 +14,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: switch_facts register: switch_facts
@ -29,7 +29,7 @@
hostname: "{{ vcenter_hostname }}" hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}" username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}" password: "{{ vcenter_password }}"
esxi_hostname: '{{ hostvars[esxi1].ansible_host }}' esxi_hostname: '{{ esxi1 }}'
validate_certs: no validate_certs: no
register: switch_facts_check_mode register: switch_facts_check_mode
check_mode: yes check_mode: yes