title: Ansible: docker env conditional variable
body: <p>Maybe I am approaching this the wrong way. I just started with Ansible and I couldn't solve this problem lately:</p>
  
  <p>So this is a snippet of what I am trying to do:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>vars:
      var1: "true"
      var2: "false"
      var3: "true"
  
  
    tasks:
    - name: my-name
      docker_container:
        name: my-name
        image: image/image
        state: started
        cap_drop: all
        pull: yes
        recreate: yes
        restart_policy: always
        env:
          env1: "value"
          env2: "value"
          env3: "value"</code></pre>
  </div>
  </div>
  </p>
  
  <p>So the idea is to set var1 to var3 to "true" or "false" and then make the value of env1 to env3 depending on the vars.</p>
  
  <p>So for example:</p>
  
  <p>If var1 is true, the env1 should contain "some value". But if var1 is false, the env1 should contain "an other value".</p>
  
  <p>I would also use AWX and change the value of the vars by "SURVEYS".</p>
  
  <p>I am open to other suggestions, of course. How would you guys solve this?</p>