wait_for esxi host to be available in vcenter an exist mateinance mode

17 views
Skip to first unread message

Tony Wong

unread,
Jun 13, 2023, 4:37:21 PM6/13/23
to Ansible Project
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?

nametest

  hostsall

  gather_factsno

  vars_files:

    - vcenter_creds.yml

    - vars.yml

 

  tasks:

 

    - nameEnable SSH service

      vmware_host_service_manager:

        hostname'{{ vcenter_hostname }}'

        username'{{ vcenter_admin }}'

        password'{{ vcenter_admin_pass }}'

        esxi_hostname"{{ inventory_hostname }}"

        validate_certsno

        statepresent

        service_name"TSM-SSH"

      delegate_tolocalhost

 

    - nameEsxcli

      shell:

        cmd'{{ cmd }}'

      registeresxcli_output

 

    - nameDisplay esxcli output

      debug:

        varesxcli_output.stdout_lines

 

    - nameReboot ESXi host

      vmware_host_powerstate:

        hostname'{{ vcenter_hostname }}'

        username'{{ vcenter_admin }}'

        password'{{ vcenter_admin_pass }}'

        esxi_hostname"{{ inventory_hostname }}"

        validate_certsno

        statereboot-host

      delegate_tolocalhost

 

    - nameWait for ESXi host to become available

      wait_for:

        host"{{ inventory_hostname }}"

        port443

        delay10

        timeout300

        statestarted

      delegate_tolocalhost





Reply all
Reply to author
Forward
Message has been deleted
0 new messages