how to use dynamic variable set in one play as an input to a task in another play

Hiya.

In my playbook, I have two plays: the first is to be run on the control host, the second is run on a set of remote app hosts. What I want to do is have a variable determined by a task in the first play be used as a shell script argument for a task in the second play. I don’t know how to do this. Can anyone help? Is this possible?

Here’s a simplification of how these are called in my ansible deployment orchestration playbook. The json determined by a tool on the control host in common/test_prep.yml needs to be used as the input parameter to a tool which is called inside of ``common/test_client_check.yml on each client 'myhosts'.

`
$ cat testplaybook.yml

the data you want is in:

hostvars['localhost']['json_as_input_for_next_play']

Yep. Thank you! A coworker pointed out a similar post: https://groups.google.com/forum/#!searchin/ansible-project/felix/ansible-project/C51U547IXwY/2IyoNqCZpTQJ. Sorry I didn’t catch that one before I posted my question.

I feared that hostvars dict created in localhost task might not be available to the remote host. But that’s not the case, it is available and it worked.

kallen