Robert, checkout this out for examples https://github.com/oVirt/ovirt-ansible-vm-infra/blob/master/tasks/main.yml. I been using it for what you describe but, basically you have to pass a dictionary of the VM's you want to remove and the automation does everything else, with a loop and what not.
On Thu, May 9, 2019 at 1:27 PM Robert <[email protected]> wrote: > Hey everyone. > I am working on a role that will delete VM's from RHV and remove their > entries from satelite and AD. > The challenge I have is that I need to pass the current host into the name > field without doing a loop. Right now my task called destroyvm.yml looks > like this: > > - task to unregister from Satellite 6 > - task to run a script to leave the AD domain. > - task to log into RHV > - name: Destroy VMs > ovirt_vms: > auth: "{{ ovirt_auth }}" > name: "{{ item }}" > cluster: "{{ cluster }}" > state: absent > with_items: "{{ group }}" > delegate_to: "{{ rhv }}" > async: 1 > poll: 0 > > I have about 6 groups of servers with multiple servers in each group. > What is happening is for the first server in each group it runs through > everything fine and when it gets to the Destroy VMs task it destroys all > the VM's in the group before they are unregistered from Satellite and AD > (except for the first VM which is removed fine). So my question is...is > there a way to just pass the current host/VM into the name slot without > doing the loop. > > Thanks > Robert > > -- > 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 post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAJLEWMdH_GdnDtTwGqC-679nttr9beVhNBMJi4a6SZ3Nc%2BX5%3DA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAJLEWMdH_GdnDtTwGqC-679nttr9beVhNBMJi4a6SZ3Nc%2BX5%3DA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Jonathan Cha'gara Lozada De La Matta He / Him / His Automation Practice Senior Automation Consultant & Automation CoP Manager Red Hat <https://www.redhat.com> @redhatjobs <https://twitter.com/redhatjobs> redhatjobs <https://www.facebook.com/redhatjobs> @redhatjobs <https://instagram.com/redhatjobs> <https://www.redhat.com> -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BKPqATg_6r00YE0Jj%2BgemLcs831p8gp6XNq_MBwLSdHmw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
