title: How to create dynamic variables in ansible
body: <p>The real scenario, want to get a resource id of sqs in AWS, which will be returned after the execution of a playbook. So, using this variable in files to configure the application. </p>
  
  <p>Persisting variables from one playbook to another </p>
  
  <p>checking out the documentation, modules like set_fact and register have scope only for that specific host. There are many purpose of using the variables from one host to another.</p>
  
  <p>Alternatives I can think of:</p>
  
  <ol>
  <li><p>using Command module and echoing the variables to a file. Later, using the variable file using vars section or include.</p></li>
  <li><p>Setting the env variables and then accessing it but this will be difficult.</p></li>
  </ol>
  
  <p>So what is the solution? </p>