On Wed, 3 Apr 2024 12:11:34 +0300
Adrian Sevcenco <[email protected]> wrote:

> delete_groups:
> 
> loop: "{{ delete_groups }}"
> 
> The error that i receive is:
> Invalid data passed to 'loop', it requires a list, got this instead: None.

Use the filter *default*

  loop: "{{ delete_groups | default([], true) }}"

See:
https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.default

Optionally, use the module *ansible.utils.validate*
See:
https://docs.ansible.com/ansible/latest/collections/ansible/utils/validate_module.html


-- 
Vladimir Botka

-- 
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/20240403140804.117e8718%40planb.

Attachment: pgpf3SIGgcqB_.pgp
Description: OpenPGP digital signature

Reply via email to