title: Ansible Variable Error Deploying Template File
body: <p>I'm trying to deploy a JSON file as a template and configure the variables for it in a group_var. Here is how I have my ansible structured:</p>
  <pre><code>inventories &gt; dc &gt; environment &gt; partner_name &gt; group_vars/hosts file &gt; host.yml
  
  └───EWR1
      ├───Prod
      │   └───Partner
      │       └───Candy
      │           └───group_vars
      └───QA
          └───Partner
              └───Tech
                  └───group_vars
  </code></pre>
  <p>I have a role for this called <code>candy_deployment</code> and in that directory I have the following other directories:</p>
  <ul>
  <li>files</li>
  <li>tasks</li>
  <li>templates</li>
  </ul>
  <p>In the host yaml, I have the following variables defined:</p>
  <pre><code>candy_vars:
  
    price: '5'
    number: '20'
    account: '3fdgdfgFGDfdgdGsdgERgtGERGetgtgTGRT'
    date: '8 Feb 2022 18:00:00 EST'
  </code></pre>
  <p>This is what I have for the template file named <code>candy_deployment.json.j2</code>:</p>
  <pre><code>{
      &quot;price&quot;: {{ candy_vars.price }},
      &quot;number&quot;: {{ candy_vars.number }},
      &quot;gatekeeper&quot;: null,
      &quot;solTreasuryAccount&quot;: &quot;{{ candy_vars.account }}&quot;,
      &quot;splTokenAccount&quot;: null,
      &quot;splToken&quot;: null,
      &quot;goLiveDate&quot;: &quot;{{ candy_vars.date }}&quot;,
      &quot;endSettings&quot;: null,
      &quot;whitelistMintSettings&quot;: null,
      &quot;hiddenSettings&quot;: null,
      &quot;storage&quot;: &quot;storage&quot;,
      &quot;ipfsInfuraProjectId&quot;: null,
      &quot;ipfsInfuraSecret&quot;: null,
      &quot;awsS3Bucket&quot;: null,
      &quot;noRetainAuthority&quot;: false,
      &quot;noMutable&quot;: false
  }
  </code></pre>
  <p>When I run ansible in AWX I get the following error:</p>
  <pre><code>{
    &quot;msg&quot;: &quot;AnsibleUndefinedVariable: 'candy_vars' is undefined&quot;,
    &quot;_ansible_no_log&quot;: false,
    &quot;changed&quot;: false
  }
  </code></pre>
  <p>I'm not 100% on why it's not seeing the variables and I'm a bit lost reading the configs. Any guidance would be really appreciated.</p>
  <p>Thank You!</p>