title: How can I pass captured data between two Rundeck Job References?
body: <p>I am trying to figure out if it is possible in Rundeck to generate output from one Job Reference, capture it as a global variable, and pass that variable to a second Job Reference.</p>
  
  <h2>Job Reference 1</h2>
  
  <p>Step 1 executes a PowerShell script on node WinServer1.  The output is an FQDN (for example, workstation1.yadayada.com).  I have a Key/Value/Data filter that captures this output as hostname.  It is accessible via ${data.hostname*@WinServer1}.</p>
  
  <p>Step 2 creates a Global Variable using the following:<br/>
  Value:  ${data.hostname*@WinServer1}<br/>
  Group:  export<br/>
  Name:  hostname</p>
  
  <p>Step 3 is a test to output.</p>
  
  <pre><code>Write-Host "data.hostname = @data.hostname@"
  Write-Host "export.hostname = @export.hostname@"
  </code></pre>
  
  <p>The output of these commands are as expected:</p>
  
  <blockquote>
    <p>data.hostname =   workstation1.yadayada.com<br/>
    export.hostname =   workstation1.yadayada.com<br/></p>
  </blockquote>
  
  <h2>Job Reference 2</h2>
  
  <p>Step 1, for the purposes of this example, is the same PowerShell code as shown above.  The output is as follows:</p>
  
  <blockquote>
    <p>data.hostname =   <br/>
    export.hostname =  <br/></p>
  </blockquote>
  
  <hr>
  
  <p>In Job Reference 2, I would expect for data.hostname to be empty, but I am expecting export.hostname to contain workstation1.yadayada.com as I made it a global variable.  Am I misunderstanding how global variables work in Rundeck?  Is there a way to accomplish what I am trying to do?  I'm happy to supply any additional information that may be useful in troubleshooting this issue.</p>
  
  <p><strong>Some Other Things I've Tried</strong></p>
  
  <ul>
  <li>I have attempted to pass the export.hostname variable as an argument to Job Reference 2 Step 1, but I had the same results.  </li>
  <li>I have attempted to move the Global Variable step into the parent job between the two Job Reference steps, but the ${data.hostname*@WinServer1} is empty by the time that step runs.</li>
  <li>I have attempted to put the exact same Key/Value/Data log filter on the parent job, but it won't even capture the data for whatever reason.</li>
  </ul>