title: Ansible, set_fact using if then else statement
body: <p>I am trying to set a variable in Ansible with set_fact at runtime based upon another variable. If uses first value no matter what the actual value is. Here is my code example:</p>
  
  <pre><code>- name: Global_vars - get date info
      set_fact:  
        jm_env: "{{lookup('env', 'Environment')}}"
        l_env: "{% if '{{jm_env}}==Develop' %}d{% elif '{{jm_env}}==Staging'%}s{% else %}p{% endif %}"
  </code></pre>
  
  <p><code>l_env</code> is <code>d</code> no matter what <code>jm_env</code> is set.</p>