On Fri, 16 Oct 2020 07:15:03 -0700 (PDT)
jean-christophe manciot <[email protected]> wrote:

> Regarding my last remark, I probably should rather define the empty 
> workstations as:
> ```
>                 empty_workstations:
>                         workstations:
>                           - name:
>                             revision:
>                             url:
> ```
> What are your thoughts?

It's up to you. If you need default values put them into the
empty_workstation, or better in this case, into the
default_workstations. For example

                 default_workstations:
                   workstations:
                     - name: name_default
                       revision: revision_default
                       url: url_default

Otherwise, you might want to simply skip the empty lists. For example

    - debug:
        msg: "{{ item.name }}:
              {{ item.workstations|
                 selectattr('name', 'eq', os_name)|
                 selectattr('revision', 'eq', os_revision)|
                 map(attribute= 'url')|
                 list }}"
      loop: "{{ domain_definition }}"
      when: item.workstations|length > 0
      vars:
        os_name: ubuntu1
        os_revision: '2017-08-16'

-- 
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/20201016164824.02fbff7d%40gmail.com.

Attachment: pgpY8hCs7oV3d.pgp
Description: OpenPGP digital signature

Reply via email to