title: In Ansible, how do I use a variable in an inventory file in a template
body: <p>I have this inventory file</p>
  
  <p>inventory/hosts_elk</p>
  
  <pre><code>[elk-client-0]
  10.11.22.22
  </code></pre>
  
  <p>Now I have a template, and I want to do this</p>
  
  <p>elk_server.yml.j2</p>
  
  <pre><code>elk_server = {{ elk-client-0 }}
  </code></pre>
  
  <p>But that doesn't work, that is the value for {{ elk-client-0 }} does NOT get substituted.</p>
  
  <p>What is the correct syntax so when the template gets laid out on the server, the resulting file looks like</p>
  
  <pre><code>elk_server = 10.11.22.22
  </code></pre>