ansible.builtin.nested (v2.16.5) — lookup

composes a list with nested elements of other lists

| "added in version" 1.1 of ansible.builtin"

Authors: unknown

Install Ansible via pip

Install with pip install ansible-core==2.16.5

Description

Takes the input lists and returns a list with elements that are lists composed of the elements of the input lists

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: give users access to multiple databases
  community.mysql.mysql_user:
    name: "{{ item[0] }}"
    priv: "{{ item[1] }}.*:ALL"
    append_privs: yes
    password: "foo"
  with_nested:
    - [ 'alice', 'bob' ]
    - [ 'clientdb', 'employeedb', 'providerdb' ]
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# As with the case of 'with_items' above, you can use previously defined variables.:

- name: here, 'users' contains the above list of employees
  community.mysql.mysql_user:
    name: "{{ item[0] }}"
    priv: "{{ item[1] }}.*:ALL"
    append_privs: yes
    password: "foo"
  with_nested:
    - "{{ users }}"
    - [ 'clientdb', 'employeedb', 'providerdb' ]

Inputs

    
_raw:
    description:
    - a set of lists
    required: true

Outputs

_list:
  description:
  - A list composed of lists paring the elements of the input lists
  type: list