From c7e1a65da4ff06ead2202dcb3eea30787566ca86 Mon Sep 17 00:00:00 2001 From: Gerben Geijteman Date: Wed, 2 Mar 2016 13:12:30 +0100 Subject: [PATCH] Proposed change to documentation to elaborate on new notation style for with_items / with_subelements --- docsite/rst/playbooks_loops.rst | 4 ++-- samples/with_subelements.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docsite/rst/playbooks_loops.rst b/docsite/rst/playbooks_loops.rst index 5d88da5af8..e329d7650d 100644 --- a/docsite/rst/playbooks_loops.rst +++ b/docsite/rst/playbooks_loops.rst @@ -204,7 +204,7 @@ It might happen like so:: - authorized_key: "user={{ item.0.name }} key='{{ lookup('file', item.1) }}'" with_subelements: - - users + - "{{ users }}" - authorized 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 mysql_user: name={{ item.0.name }} password={{ item.0.mysql.password }} host={{ item.1 }} priv={{ item.0.mysql.privs | join('/') }} with_subelements: - - users + - "{{ users }}" - mysql.hosts Subelements walks a list of hashes (aka dictionaries) and then traverses a list with a given (nested sub-)key inside of those diff --git a/samples/with_subelements.yml b/samples/with_subelements.yml index 95d0dda67c..0037f4a631 100644 --- a/samples/with_subelements.yml +++ b/samples/with_subelements.yml @@ -14,5 +14,5 @@ tasks: - debug: msg="user={{ item.0.name }} key='{{ item.1 }}'" with_subelements: - - users + - "{{ users }}" - authorized