Correct $last_result example in playbooks doc
This commit is contained in:
parent
f9a2f4687e
commit
dd5629cd51
1 changed files with 2 additions and 2 deletions
|
@ -262,11 +262,11 @@ One common useful trick with only_if is to key off the changed result of a last
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- action: template src=/templates/foo.j2 dest=/etc/foo.conf
|
- action: template src=/templates/foo.j2 dest=/etc/foo.conf
|
||||||
|
register: last_result
|
||||||
- action: command echo 'the file has changed'
|
- action: command echo 'the file has changed'
|
||||||
only_if: '${last_result.changed}'
|
only_if: '${last_result.changed}'
|
||||||
|
|
||||||
$last_result is a variable automatically set by Ansible, and it is a boolean, so there is no need
|
$last_result is a variable set by the register directive. This assumes Ansible 0.8 and later.
|
||||||
to test for it against something else with an explicit equals. This assumes Ansible 0.8 and later.
|
|
||||||
|
|
||||||
In Ansible 0.8, a few shortcuts are available for testing whether a variable is defined or not::
|
In Ansible 0.8, a few shortcuts are available for testing whether a variable is defined or not::
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue