Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
d3a97bfb
Commit
d3a97bfb
authored
Jul 15, 2013
by
Javier Candeira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add documentation for with_nested
parent
d05462fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
docsite/latest/rst/playbooks2.rst
+19
-0
No files found.
docsite/latest/rst/playbooks2.rst
View file @
d3a97bfb
...
...
@@ -447,6 +447,25 @@ If you have a list of hashes, you can reference subkeys using things like::
- { name: 'testuser1', groups: 'wheel' }
- { name: 'testuser2', groups: 'root' }
Nested Loops
````````````
Loops can be nested too:
- name: give all employees access to every departament's database
mysql_user: name={{ item[0] }} priv={{ item[1] }}.*:*
with_nested:
- [ 'alice', 'bob', 'eve' ]
- [ 'clientdb', 'employeedb', 'providerdb' ]
As with the case of 'with_items" above, you can use previously defined variables, and you can use their raw name without templating it with '{{ }}'.
- name: here, 'users' contains the above list of employees
mysql_user: name={{ item[0] }} priv={{ item[1] }}.*:*
with_nested:
- users
- [ 'clientdb', 'employeedb', 'providerdb' ]
Lookup Plugins - Accessing Outside Data
```````````````````````````````````````
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment