Using data return from tasks for subsequent tasks

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.

There is already a filesystem module.

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/

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

~saurabh