I got this pb. In stead of waiting for port 443 available. I need to have it shows as available or back in a connected state or in maintenance mode in vcenter then exit maintenance mode. any idea how?
- name: test
hosts: all
gather_facts: no
vars_files:
-
vcenter_creds.yml
-
vars.yml
tasks:
- name: Enable SSH service
vmware_host_service_manager:
hostname: ‘{{ vcenter_hostname }}’
username: ‘{{ vcenter_admin }}’
password: ‘{{ vcenter_admin_pass }}’
esxi_hostname: “{{ inventory_hostname }}”
validate_certs: no
state: present
service_name: “TSM-SSH”
delegate_to: localhost
- name: Esxcli
shell:
cmd: ‘{{ cmd }}’
register: esxcli_output
- name: Display esxcli output
debug:
var: esxcli_output.stdout_lines
- name: Reboot ESXi host
vmware_host_powerstate:
hostname: ‘{{ vcenter_hostname }}’
username: ‘{{ vcenter_admin }}’
password: ‘{{ vcenter_admin_pass }}’
esxi_hostname: “{{ inventory_hostname }}”
validate_certs: no
state: reboot-host
delegate_to: localhost
- name: Wait for ESXi host to become available
wait_for:
host: “{{ inventory_hostname }}”
port: 443
delay: 10
timeout: 300
state: started
delegate_to: localhost