On 6/15/20 9:39 PM, Rafael Tomelin wrote:
>
> Hi guys,
>
> I have a task with equal below, but when I validate it is defined it not
> recognized.
> - name: include vars virtual_machine
> include_tasks: virtual_machine.yml
> when:
> - gms_az_vm_action == 'create_virtual_machine'
> -
OK, thanks!
On Mon, Jun 15, 2020 at 4:42 PM Matt Martz wrote:
> In the case of using `when` and `loop`, the `when` statements is applied
> to each iteration of the `loop`, and not before it.
>
> As such, you cannot prevent a loop from happening using a when statement.
>
> Instead you want to do
In the case of using `when` and `loop`, the `when` statements is applied to
each iteration of the `loop`, and not before it.
As such, you cannot prevent a loop from happening using a when statement.
Instead you want to do this in loop, like:
loop: '{{ virtual_machine|default({})|dict2items }}'
Hi guys,
I have a task with equal below, but when I validate it is defined it not
recognized.
- name: include vars virtual_machine
include_tasks: virtual_machine.yml
when:
- gms_az_vm_action == 'create_virtual_machine'
- virtual_machine is defined
loop: "{{ virtual_machine|dict2items }}"
How I