title: Ansible call variable inside a variable
body: <p>How would I call a variable inside a variable in Ansible</p>
  
  <p>So I have the following</p>
  
  <p>Meta > Main.yml</p>
  
  <pre><code> - { role: core_nat_segment, foo: 'bar' }
  </code></pre>
  
  <p>Task > Main.yml</p>
  
  <pre><code>- name: Create resources for e-commerce services
    cloudformation:
      stack_name: "{{aws_environment}}-yyy"
      state: "present"
      region: "{{aws_region}}"
      template: "xx
      template_parameters:
        ECSClusterName: "{{{{segment_name}}_private_stack.stack_outputs.PrivateCluster}}"
  </code></pre>
  
  <p>When i run the playbook I get the following error</p>
  
  <pre><code>fatal: [localhost] =&gt; Failed to template {{{{segment_name}}_private_stack.stack_outputs.PrivateCluster}}: template error while templating string: expected token ':', got '}'
  </code></pre>
  
  <p>The output im expecting is</p>
  
  <pre><code>bar_private_stack.stack.stack_outputs.PrivateCluster
  </code></pre>
  
  <p>Any help pointers would be much appreciated.</p>