Hi,
What i'm looking for specifically is to be able to do something
like
tasks:
- include: ec2/new_instance.yml region=us-west2 env=staging
- include apiserver/setup.yml instanceid=(the one setup above)
- include apiserver/runtests.yml instanceid=(the one setup above)
- include ec2/terminate_instance.yml instanceid=(the one setup
above)
IMO the ability for one task to inject variables back into the
playbook would be immensely powerful.
Karthik
Tasks can actually do this, they just have to return a dictionary of ansible_facts.
A patch to enable “last result” of some kind would not work well, because a given include statement could have many many tasks, and you also wouldn’t want to say
“back up the stack N”.
A better idea is probably to have something like “save_result_as: varname”
(this being a variable saved in SETUP_CACHE, most likely, and obviously usable in templates and not just action lines)
This would potentially be useful with things like only_if, where you could run one command and then switch on the result.
If someone can get me a decently clean patch to do this, I think it’s a useful feature.