title: How can I persist an ansible variable across ansible roles?
body: <p>I've registered a variable in a play.</p>
  
  <pre><code>---
  - hosts: 127.0.0.1
    gather_facts: no
    connection: local
    sudo: no
    vars_files:
      - vars.yml
    tasks:
      - name: build load balancer
        os_load_balancer: net=mc_net ext_net=vlan3320 name=load_balancer protocol=HTTPS port=80
        register: my_lb
  </code></pre>
  
  <p>I can access that variable fine, until I make the request inside a role.</p>
  
  <p>For example, in a separate role in the same run, I want to access that registered variable:</p>
  
  <pre><code>- debug: var=my_lb
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>{'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'my_lb' is undefined", 'failed': True}
  </code></pre>
  
  <p>How can I access variables registered in a separate role, within the same play?</p>
  
  <blockquote>
    <p>Edit for clarity of how things piece together:</p>
  
  <pre><code>Top Play
  -includes: 
    - Sub play 1
      - registers variable foo
    - Sub play 2
      -includes:
        - sub play A
          - role 1 
          - role 2
          - role 3 
            - references variable foo in template
        - Sub play B
    - Sub play 3
  </code></pre>
  </blockquote>