# Using data return from tasks for subsequent tasks

**URL:** <https://forum.ansible.com/t/using-data-return-from-tasks-for-subsequent-tasks/13601>\
**Category:** Ansible Project\
**Created:** [October 3, 2013, 8:51am UTC](https://forum.ansible.com/t/using-data-return-from-tasks-for-subsequent-tasks/13601 "2013-10-03T08:51:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saurabh\_verma](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@saurabh\_verma](https://forum.ansible.com/u/saurabh_verma)\
**Post date:** [October 3, 2013, 8:51am UTC](https://forum.ansible.com/t/using-data-return-from-tasks-for-subsequent-tasks/13601/1 "2013-10-03T08:51:51Z")

</div>

Hi,

I am a bit confused here,

Basically I want to use ec2-vol modules ( somehow i want to dynamically generate the instance ID inside the playbook or use it from vars ) , get the device name attached, use this data for another tasks probably through another module for formatting the device and mounting it back on instance and then I want to log/store the data returned from this task as return status.

Any idea how can i achieve these kind of requirements ? I can create a module for formatting and building a filesystem if its not already present.

Basically I want to imitate unix pipes,

task1 | tasks2 | tasks\_final

And / Or

task1 | tee return\_data1 | tasks2 | tee return\_data2 | tasks\_final | tee return\_data\_final

Regards,  
Saurabh Verma  
Sr. Systems Architect  
Directi.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 3, 2013, 12:20pm UTC](https://forum.ansible.com/t/using-data-return-from-tasks-for-subsequent-tasks/13601/2 "2013-10-03T12:20:40Z")

</div>

There is already a filesystem module.

[http://www.ansibleworks.com/docs/modules.html#filesystem](http://www.ansibleworks.com/docs/modules.html#filesystem)

If you want to save the results of commands, look into the ‘register’ keyword and use ‘-v’ after running steps to see what each returns.

We’re going to be upgrading docs (and the module formatter support that code generates our docs) to show sample return values soon, though “register” will do exactly what you want to save the value of one command.

Ansible is naturally an ordered pipeline.

Logging can be accomplished by turning on the setting in ansible.cfg. If you don’t have an ansible.cfg because you installed by a non-package method, there’s a copy in the examples/ directory of the checkout.

If you want really great database history and red-green status for all of your hosts, our “AWX” product does a fantastic job of this: [http://www.ansibleworks.com/ansibleworks-awx/](http://www.ansibleworks.com/ansibleworks-awx/)

---

<div class="post-metadata">

**Author:** ![saurabh\_verma](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@saurabh\_verma](https://forum.ansible.com/u/saurabh_verma)\
**Post date:** [October 4, 2013, 2:19pm UTC](https://forum.ansible.com/t/using-data-return-from-tasks-for-subsequent-tasks/13601/3 "2013-10-04T14:19:23Z")

</div>

Thanks for your reply. I will work on getting the playbook working and will get back to you if needed

~saurabh
