documented cartesian lookup in 1.9

This commit is contained in:
Brian Coca 2015-02-20 09:06:17 -05:00
parent 5d946ec4f2
commit 965680a18e

View file

@ -95,10 +95,6 @@ To enter comma use two commas ',,' somewhere - preferably at the end. Quotes and
More Lookups More Lookups
```````````` ````````````
.. note:: This feature is very infrequently used in Ansible. You may wish to skip this section.
.. versionadded:: 0.8
Various *lookup plugins* allow additional ways to iterate over data. In :doc:`Loops <playbooks_loops>` you will learn Various *lookup plugins* allow additional ways to iterate over data. In :doc:`Loops <playbooks_loops>` you will learn
how to use them to walk over collections of numerous types. However, they can also be used to pull in data how to use them to walk over collections of numerous types. However, they can also be used to pull in data
from remote sources, such as shell commands or even key value stores. This section will cover lookup from remote sources, such as shell commands or even key value stores. This section will cover lookup
@ -129,10 +125,18 @@ Here are some examples::
- debug: msg="{{ lookup('etcd', 'foo') }} is a value from a locally running etcd" - debug: msg="{{ lookup('etcd', 'foo') }} is a value from a locally running etcd"
# The following lookups were added in 1.9
- debug: msg="{{item}}" - debug: msg="{{item}}"
with_url: with_url:
- 'http://github.com/gremlin.keys' - 'http://github.com/gremlin.keys'
# outputs the cartesian product of the supplied lists
- debug: msg="{{item}}"
with_cartesian:
- list1
- list2
- list3
As an alternative you can also assign lookup plugins to variables or use them As an alternative you can also assign lookup plugins to variables or use them
elsewhere. This macros are evaluated each time they are used in a task (or elsewhere. This macros are evaluated each time they are used in a task (or
template):: template)::