mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Proposed change to documentation to elaborate on new notation style for with_items / with_subelements
This commit is contained in:
@@ -204,7 +204,7 @@ It might happen like so::
|
|||||||
|
|
||||||
- authorized_key: "user={{ item.0.name }} key='{{ lookup('file', item.1) }}'"
|
- authorized_key: "user={{ item.0.name }} key='{{ lookup('file', item.1) }}'"
|
||||||
with_subelements:
|
with_subelements:
|
||||||
- users
|
- "{{ users }}"
|
||||||
- authorized
|
- authorized
|
||||||
|
|
||||||
Given the mysql hosts and privs subkey lists, you can also iterate over a list in a nested subkey::
|
Given the mysql hosts and privs subkey lists, you can also iterate over a list in a nested subkey::
|
||||||
@@ -212,7 +212,7 @@ Given the mysql hosts and privs subkey lists, you can also iterate over a list i
|
|||||||
- name: Setup MySQL users
|
- name: Setup MySQL users
|
||||||
mysql_user: name={{ item.0.name }} password={{ item.0.mysql.password }} host={{ item.1 }} priv={{ item.0.mysql.privs | join('/') }}
|
mysql_user: name={{ item.0.name }} password={{ item.0.mysql.password }} host={{ item.1 }} priv={{ item.0.mysql.privs | join('/') }}
|
||||||
with_subelements:
|
with_subelements:
|
||||||
- users
|
- "{{ users }}"
|
||||||
- mysql.hosts
|
- mysql.hosts
|
||||||
|
|
||||||
Subelements walks a list of hashes (aka dictionaries) and then traverses a list with a given (nested sub-)key inside of those
|
Subelements walks a list of hashes (aka dictionaries) and then traverses a list with a given (nested sub-)key inside of those
|
||||||
|
|||||||
@@ -14,5 +14,5 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- debug: msg="user={{ item.0.name }} key='{{ item.1 }}'"
|
- debug: msg="user={{ item.0.name }} key='{{ item.1 }}'"
|
||||||
with_subelements:
|
with_subelements:
|
||||||
- users
|
- "{{ users }}"
|
||||||
- authorized
|
- authorized
|
||||||
|
|||||||
Reference in New Issue
Block a user