nested – composes a list with nested elements of other lists — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# nested – composes a list with nested elements of other lists

- Synopsis
- Parameters
- Examples
- Return Values
- Status

## Synopsis

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

## Parameters

Parameter | Choices/Defaults | Configuration | Comments
--- | --- | --- | ---
_raw - / required |  |  | a set of lists

## Examples

    - name: give users access to multiple databases
      mysql_user:
        name: "{{ item[0] }}"
        priv: "{{ item[1] }}.*:ALL"
        append_privs: yes
        password: "foo"
      with_nested:
        - [ 'alice', 'bob' ]
        - [ 'clientdb', 'employeedb', 'providerdb' ]
    # As with the case of 'with_items' above, you can use previously defined variables.:

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

## Return Values

Common return values are documented here, the following are the fields unique to this lookup:

Key | Returned | Description
--- | --- | ---
_list list |  | A list composed of lists paring the elements of the input lists

## Status

- This lookup is not guaranteed to have a backwards compatible interface. [preview]
- This lookup is maintained by the Ansible Community. [community]

### Authors

- UNKNOWN

Hint

If you notice any issues in this documentation, you can edit this document to improve it.

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.