title: Create set_fact variables in one role and use them in an other
body: <p>I have a complicated environment with stages and users for multiple systems.</p>
  
  <p>The stages are: dev, int, etc.</p>
  
  <p>Each stage has a user for an application, let's call the user john. That leads
  to a user johnd for dev and johni for int and so on.</p>
  
  <p>To abstract the system management, since all systems in the stages are the same,
  I created this data structure:</p>
  
  <pre><code>users:
    john:
      dev:
        name: "johnd"
      int:
        name: "johni"
  </code></pre>
  
  <p>Now I have a role "collect_user_information" which collects all kind of informations from LDAP and stores them in a variable with help of set_fact.</p>
  
  <pre><code>- name: Get the userhome out of LDAP
    shell: 'getent passwd {{ users[ user ][ stage ].name }} | cut -d: -f6'
    register: user_home
  </code></pre>
  
  <p>And set_fact:</p>
  
  <pre><code>- name: set facts for LDAP user
    set_fact:
      "{{user}}":
        name: "{{ users[ user ][ stage ].name }}"
        home: "{{ user_home.stdout }}"
  </code></pre>
  
  <p>To dump the variable, I use:</p>
  
  <pre><code>- name: debug output for myuser
    debug: var="{{user}}"
  </code></pre>
  
  <p>The debug output looks promissing.</p>
  
  <pre><code>TASK [collect_user_information : debug output for user] *******
  ok: [host1] =&gt; {
    "john": {
       "home": "/home/johni",-
       "name": "johni"
    }
  }
  </code></pre>
  
  <p>Now I would like to execute a role to create the users home.</p>
  
  <pre><code>- { role: create_user_home, user: "john" }
  </code></pre>
  
  <p>First I dump the entries of my variable:</p>
  
  <pre><code>- name: debug role create_user_home output for variable user
    debug: var=user
  
  TASK [create_user_home : debug role create_user_home output for variable user] ***********
  ok: [host1] =&gt; {
      "user": "john"
  }
  
  - name: debug role create_user_home output for variable john
    debug: var={{ user }}
  
  TASK [create_user_home : debug role create_user_home output for variable john] **********
  ok: [host1] =&gt; {
      "john": {
          "home": "/home/johni",-
          "name": "johni"
      }
  }       
  </code></pre>
  
  <p>Now I would like use this data structure. I would guess I can access the values by referencing "{{user.name}}" or "{{user['name']}}', but neither works.</p>
  
  <pre><code>TASK [create_user_home : Create home directories for john] ***********************
  fatal: [host1]: FAILED! =&gt; {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'ansible.parsing.yaml.objects.AnsibleUnicode object' has no attribute 'home'\n\nThe error appears to have been in '/etc/ansible/roles/create_user_home/tasks/main.yml': line 37, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n#-------------------------------------------------------------------------------\n- name: Create home directories for john\n  ^ here\n"}
  </code></pre>
  
  <p>Well, how does it work?</p>