title: How to use variable substitution in a when condition?
body: <p>I'm a new ansible user. I need a variable in a task's when condition.
  I am trying to use home_directory variable, which is defined as home_directory: &quot;{{ ansible_env.HOME }}&quot; in the vars/main.yaml file.</p>
  <p>I tried to use something like following:</p>
  <p>when: {{ home_directory}}/var_name['var_key'] != command_output['stdout']</p>
  <p>However, I later found out that jinja templates {{}} or {%%} are not allowed/recommended in the
  when condition. I also tried condition without quotes and {{}} but home_directory value is
  not being replaced in the when condition.</p>
  <p>Could someone please tell me what I can do here?</p>