A follow-up question:
I have the "include_tasks" working, now I'm trying to expand on that. Each
iteration through retrieve's a VM's snapshot info and registers that into a
variable. This is within the "loop" task for each VM. When I try to print
that out, all I get is:
TASK [Print results]
****************************************************************************************************************************************************************************************
ok: [localhost] => {
"msg": {
"changed": false,
"failed": false,
"guest_snapshots": {}
}
}
Eventually I'd like to put that into a template and email it, but how can I
retrieve that variable for each iteration?
Thanks,
Harry
On Wednesday, February 14, 2024 at 1:38:50 PM UTC-5 Matt Martz wrote:
> 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/0e912f87-29bb-4f89-b8e7-811b1197e796n%40googlegroups.com.