New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement 'this' from proposals#74 #30957
Conversation
7c764b4
to
96bb21f
Compare
Please include some integration tests that make use of this feature. |
Reads and works well, but also needs a few words in the documentation. |
@mattclay @amenonsen Not before the proposal is accepted. |
As discussed in ansible/proposals#74 it is very convenient to be able to access the task result directly from `changed_when`, `failed_when` and `until`. For this we reserve the keyword 'this'. Examples: ```yaml # Wait until file exists - stat: path: /tmp/some.file until: this.stat.exists # Fail task when both files are identical - raw: diff foo/file1 bar/file2 failed_when: this.rc == 0 # Report a change when rc is not 2 - shell: /usr/bin/billybass --mode="take me to the river" changed_when: this.rc != 2 ```
After reevaluating this (no pun intended), we have decided it's a bit too magical and no longer want to add this feature. To discuss this further, please reach out on IRC or the mailing list: * IRC: #ansible-devel on irc.freenode.net |
SUMMARY
As discussed in ansible/proposals#74 it is very convenient to be able to access the task result directly from
changed_when
,failed_when
anduntil
.For this we reserve the keyword
this
.Examples:
ISSUE TYPE
COMPONENT NAME
task_executor
ANSIBLE VERSION
v2.5