This is pretty much what wait_for and wait_for_connection are designed to
handle.

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/wait_for_connection_module.html
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/wait_for_module.html

If you can key off a condition that indicates the provisioning has complete
(i.e. we can SSH in, or validate from an API, or check a log entry), then
you could continue through to switch the connected device.


On Mon, 23 Oct 2023 at 14:46, Kris Smith <[email protected]> wrote:

> So we have a workiing deploment for our VM's using AAP.  What I am trying
> to do is as the last step after everything is done, is change the cd from
> the bootable iso file we use to kickstart everything, back to client
> device. I cannot figure out how..
>
> What I have attempted to do (since I really don't know scripting) is edit
> one of the existing yml files which turns the VM on after all the infoblox
> and firewall objects are created..
>
> Is there even a way using Ansible to just wait 30 min after the VM is
> powered on for it to do the full deploy, then set the CD-ROM back to client
> device?
>
> ---
> - name: Create a new Virtual Machine in VMware
>   hosts: localhost
>   gather_facts: false
>   vars:
>     vcenter_hostname: '{{ lookup("env","VMWARE_HOST") }}'
>     vcenter_username: '{{ lookup("env","VMWARE_USER") }}'
>     vcenter_password: '{{ lookup("env","VMWARE_PASSWORD") }}'
>   tasks:
>     - name: "Look up the VM called {{ vm_name }} in the inventory"
>       vmware.vmware_rest.vcenter_vm_info:
>         filter_names:
>         - "{{ vm_name }}"
>       register: search_result
>
>     - name: Collect information about a specific VM
>       vmware.vmware_rest.vcenter_vm_info:
>         vm: '{{ search_result.value[0].vm }}'
>       register: test_vm1_info
>
>     # - name: Pause for 30 for build to complete
>     #   ansible.builtin.pause:
>     #     minutes: 30
>
>     - name: Set CD-ROM to Client Device
>       community.vmware.vmware_guest:
>         cdrom:
>           type: client
>         name: '{{ test_vm1_info.id }}'
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/4b377d13-1200-403c-a786-1748d47a56a1n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/4b377d13-1200-403c-a786-1748d47a56a1n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKtKohQUP_kuO9fvM3v7x7J8GqhcPqD6o%2B9VHRWOEgwNazuL-A%40mail.gmail.com.

Reply via email to