title: Additional conditions for tasks inside a block
body: <p>I'm trying to enclose tasks in the block with some when condition. Also some tasks inside this block have additional conditions.
  The problem is such tasks (with additional conditions) are skipped. Both block's condition and all additional conditions are true.</p>
  
  <p>Below there is a sample play:</p>
  
  <pre><code>- block:    
  
      - set_fact: 
          packages_to_install: "{{ packages_to_install }} + [ '{{ (distrs.stdout | from_json).postgresql }}' ]"
  
      - set_fact:
          packages_to_install: "{{ packages_to_install }} + [ '{{ (distrs.stdout | from_json).webserver }}' ]"
    when:
      - server.webserver is defined
      - server.webserver == true   
  
    when:
      - server is defined
  </code></pre>
  
  <p>So, postgresql is added to the list of packages, but webserver is not.</p>
  
  <p>According to <a href="http://docs.ansible.com/ansible/latest/playbooks_blocks.html" rel="nofollow noreferrer">the docs</a>, all tasks inside the block <em>will be executed after appending the when condition from the block and evaluating it in the task’s context</em>.
  Maybe it's not just possible in Ansible 2.4 to have enclosed tasks with additional conditions?</p>