<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">core, I believe</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.2.0
  config file = 
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Jul 19 2017, 12:34:40) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]"><pre class="notranslate"><code class="notranslate">ansible 2.3.2.0
  config file = 
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Jul 19 2017, 12:34:40) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">macOS 10.12 -&gt; CentOS 7.x</p>
<h5 dir="auto">SUMMARY</h5>

<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">Try to override a variable that is declared in <code class="notranslate">group_vars/all.yml</code> by a server-specific group_vars file.</p>

<p dir="auto"><code class="notranslate">group_vars/all.yml</code></p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="some_option: 1"><pre class="notranslate"><span class="pl-ent">some_option</span>: <span class="pl-c1">1</span></pre></div>
<p dir="auto"><code class="notranslate">group_vars/myrole.yml</code></p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="some_option: 2"><pre class="notranslate"><span class="pl-ent">some_option</span>: <span class="pl-c1">2</span></pre></div>
<p dir="auto"><code class="notranslate">inventory</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[myrole]
myhostname"><pre class="notranslate"><code class="notranslate">[myrole]
myhostname
</code></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">I expect <code class="notranslate">some_option</code> to be <code class="notranslate">2</code> on that host.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">It's <code class="notranslate">1</code>.</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">AWS Cloudformation</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Using Jinja2 to produce Cloudformation templates allows for a flexible infra provisioning solution, however at the moment it is necessary to render a Jinja2 CF template into a temp file so it can be used to invoke the CF module like so:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---

- name: Create a temp file for CF template
  command: mktemp
  register: tmpfile

- name: Create CF template
  template:
    dest: &quot;{{ tmpfile.stdout }}&quot;
    src: template.json.j2

- name: Ensure CF stack
  cloudformation:
    region: &quot;...&quot;
    stack_name: &quot;...&quot;
    state: present
    template: &quot;{{ tmpfile.stdout }}&quot;

- name: cleanup the temp file
  command: &quot;rm {{ tmpfile.stdout }}&quot;"><pre class="notranslate">---

- <span class="pl-ent">name</span>: <span class="pl-s">Create a temp file for CF template</span>
  <span class="pl-ent">command</span>: <span class="pl-s">mktemp</span>
  <span class="pl-ent">register</span>: <span class="pl-s">tmpfile</span>

- <span class="pl-ent">name</span>: <span class="pl-s">Create CF template</span>
  <span class="pl-ent">template</span>:
    <span class="pl-ent">dest</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ tmpfile.stdout }}<span class="pl-pds">"</span></span>
    <span class="pl-ent">src</span>: <span class="pl-s">template.json.j2</span>

- <span class="pl-ent">name</span>: <span class="pl-s">Ensure CF stack</span>
  <span class="pl-ent">cloudformation</span>:
    <span class="pl-ent">region</span>: <span class="pl-s"><span class="pl-pds">"</span>...<span class="pl-pds">"</span></span>
    <span class="pl-ent">stack_name</span>: <span class="pl-s"><span class="pl-pds">"</span>...<span class="pl-pds">"</span></span>
    <span class="pl-ent">state</span>: <span class="pl-s">present</span>
    <span class="pl-ent">template</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ tmpfile.stdout }}<span class="pl-pds">"</span></span>

- <span class="pl-ent">name</span>: <span class="pl-s">cleanup the temp file</span>
  <span class="pl-ent">command</span>: <span class="pl-s"><span class="pl-pds">"</span>rm {{ tmpfile.stdout }}<span class="pl-pds">"</span></span></pre></div>
<p dir="auto">It would be nice if the CF module could be invoked with a Jinja template directly:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---

- name: Ensure CF stack
  cloudformation:
    format: j2
    region: &quot;...&quot;
    stack_name: &quot;...&quot;
    state: present
    template: template.json.j2"><pre class="notranslate">---

- <span class="pl-ent">name</span>: <span class="pl-s">Ensure CF stack</span>
  <span class="pl-ent">cloudformation</span>:
    <span class="pl-ent">format</span>: <span class="pl-c1">j2</span>
    <span class="pl-ent">region</span>: <span class="pl-s"><span class="pl-pds">"</span>...<span class="pl-pds">"</span></span>
    <span class="pl-ent">stack_name</span>: <span class="pl-s"><span class="pl-pds">"</span>...<span class="pl-pds">"</span></span>
    <span class="pl-ent">state</span>: <span class="pl-s">present</span>
    <span class="pl-ent">template</span>: <span class="pl-s">template.json.j2</span></pre></div>