title: Ansible Template: Trying to index into a two level list
body: <p>In Ansible, I'm trying to template out apache virtual host configurations, one per file.</p>
  <p>I've got a jinja template that contains this:</p>
  <pre><code>...
  DocumentRoot {{ mydomain.DocumentRoot }}
  ...
  </code></pre>
  <p>And I've got a playbook that calls the template,which contains:</p>
  <pre><code>vars:
    domain1:
      DocumentRoot: /var/www/html/domain1
    domain2: 
      DocumentRoot: /var/www/html/domain2
  </code></pre>
  <p>I want to be able to push out this template choosing between domain1 and domain2 to select the DocumentRoot (and other variables not shown)</p>
  <p>So I need to somehow write in my template that mydomain should be substituted with 'domain1' or 'domain2'.</p>
  <p>Among other things, I tried</p>
  <pre><code>ansible-playbook myplaybook.yml  -e mydomain=domain1
  </code></pre>
  <p>with no luck.</p>
  <p>I need some sort of variable indirection, but I don't know how to write it, or even if it's possible.</p>
  <p>I know that I should be able to iterate over the contents of an array, so why can't I construct a simple indirection.</p>
  <p>Any way to accomplish this?</p>