title: Is possible define a var at run-time and use it to access another var?
body: <p>I'm not sure that this is possible. </p>
  
  <p>I want to define a var at run-time and use it to access another var(defined in file,playbook..).</p>
  
  <ol>
  <li><p>defined at run-time :</p>
  
  <pre><code>typeConfig (possible values: "in_config" or "out_config")
  </code></pre></li>
  <li><p>defined in playbook:</p>
  
  <pre><code>in_config:
    url_config: http://localhost/configuration
  
  out_config:
    url_config: http://config.pi.dyn-dns.org/configuration
  </code></pre></li>
  </ol>
  
  <p>I need to resolve something similar to this:</p>
  
  <pre><code>{{ {{ typeConfig }}.url_config }}
  </code></pre>
  
  <p>I try with:</p>
  
  <pre><code>- name: Mytest
    hosts: all
    gather_facts: false
    sudo: yes
    vars:
      - in_config:
           url_config: http://localhost/configuration
      - out_config:
           url_config: http://config.pi.dyn-dns.org/configuration
    tasks:
       - set_fact:
            typeConfig: in_config
       - name: Value in_config.url_config
         debug: msg=" {{in_config.url_config}}"
  
       - name: Value out_config.url_config
         debug: msg=" {{out_config.url_config}}"
  
       - name: Value typeConfig
         debug: var=typeConfig
  
       - debug: msg="{{ {{ typeConfig }}.url_config }} "
  </code></pre>
  
  <p>ACTUAL RESULTS</p>
  
  <blockquote>
    <p>task path: /home/nor/gitrepos/iiot-iac/ansible/myUnitTest.yml:19
    fatal: [node1]: FAILED! => {
        "failed": true, 
        "msg": "template error while templating string: expected token ':', got '}'. String: {{ {{ typeConfig }}.url_config }} " } " }</p>
  </blockquote>