Update lookup.rst (#72831)
##### SUMMARY Set correct indentation. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr
This commit is contained in:
parent
938199e34a
commit
202689b1c0
1 changed files with 4 additions and 4 deletions
|
@ -36,13 +36,13 @@ You can use lookup plugins anywhere you can use templating in Ansible: in a play
|
|||
.. code-block:: YAML+Jinja
|
||||
|
||||
vars:
|
||||
file_contents: "{{lookup('file', 'path/to/file.txt')}}"
|
||||
file_contents: "{{ lookup('file', 'path/to/file.txt') }}"
|
||||
|
||||
Lookups are an integral part of loops. Wherever you see ``with_``, the part after the underscore is the name of a lookup. For this reason, most lookups output lists and take lists as input; for example, ``with_items`` uses the :ref:`items <items_lookup>` lookup::
|
||||
|
||||
tasks:
|
||||
- name: count to 3
|
||||
debug: msg={{item}}
|
||||
debug: msg={{ item }}
|
||||
with_items: [1, 2, 3]
|
||||
|
||||
You can combine lookups with :ref:`filters <playbooks_filters>`, :ref:`tests <playbooks_tests>` and even each other to do some complex data generation and manipulation. For example::
|
||||
|
@ -51,8 +51,8 @@ You can combine lookups with :ref:`filters <playbooks_filters>`, :ref:`tests <pl
|
|||
- name: valid but useless and over complicated chained lookups and filters
|
||||
debug: msg="find the answer here:\n{{ lookup('url', 'https://google.com/search/?q=' + item|urlencode)|join(' ') }}"
|
||||
with_nested:
|
||||
- "{{lookup('consul_kv', 'bcs/' + lookup('file', '/the/question') + ', host=localhost, port=2000')|shuffle}}"
|
||||
- "{{lookup('sequence', 'end=42 start=2 step=2')|map('log', 4)|list)}}"
|
||||
- "{{ lookup('consul_kv', 'bcs/' + lookup('file', '/the/question') + ', host=localhost, port=2000')|shuffle }}"
|
||||
- "{{ lookup('sequence', 'end=42 start=2 step=2')|map('log', 4)|list) }}"
|
||||
- ['a', 'c', 'd', 'c']
|
||||
|
||||
.. versionadded:: 2.6
|
||||
|
|
Loading…
Reference in a new issue