No, you cannot loop on a block.  You can put the tasks in another YAML
file, and use `include_tasks` instead, which you can loop on.

On Wed, Feb 14, 2024 at 12:19 PM [email protected] <[email protected]>
wrote:

> I'd like to do an operation on several VMs that have 2 plays for each.
> Those are using the VMware collection to find the VMs folder in the
> datacenter, then use that folder to take a snapshot of the VM.
>
> What I was hoping to do was something like this:
>
> block:
>   - name: Find folder
>     <play to retrieve folder info>
>
>   - name: Take snapshot
>     <play to take the snapshot>
> with_items:
>   - "vm1"
>   - "vm2"
>
> Is this possible?
>
> Thanks,
> Harry
>
> --
> 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/6e23a052-353e-4936-a048-0f87b141e7c8n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/6e23a052-353e-4936-a048-0f87b141e7c8n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v8YVqGnq1iUwy1TmtMYVasTcgwFRis%3D6GrQTTD7HU%3DfLw%40mail.gmail.com.

Reply via email to