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:
- 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 %}"
l_env
is d
no matter what jm_env
is set.