On Tue, 11 Oct 2022 16:05:42 +0200
Dick Visser <dnmvis...@gmail.com> wrote:

> list structure that is defaulted to a single (dict) item ...
> additional items use the keys of the first item as their default.

For example, given the default dictionary and the extra list

    defaults:
      name: default
      desc: standard
      foo: true
      bar: true

    extra:
      - name: foobar
        desc: dedicated
      - name: noli
        desc: discovery

the declaration below

    discos: "{{ [defaults] +
                [defaults]|product(extra)|map('combine')|list }}"

gives the expected list

  discos:
  - bar: true
    desc: standard
    foo: true
    name: default
  - bar: true
    desc: dedicated
    foo: true
    name: foobar
  - bar: true
    desc: discovery
    foo: true
    name: noli

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20221011175709.189ee983%40gmail.com.

Attachment: pgpSJiTRJybHe.pgp
Description: OpenPGP digital signature

Reply via email to