Repository: ansible/ansible

Issue:
Including an empty task within a "block" disables the complete block
##### ISSUE TYPE
 - Bug Report


##### COMPONENT NAME
block

##### ANSIBLE VERSION
```
ansible 2.3.1.0
  config file = /..../ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
```

##### CONFIGURATION
gathering = smart

##### OS / ENVIRONMENT
CentOS Linux release 7.3.1611 (Core) 

##### SUMMARY
When including an empty task is included within a block, none of the included tasks is executed

##### STEPS TO REPRODUCE
Create three playbooks:

- Main playbook: 

```yaml
---
- hosts: myhost
  tasks:
    - block:
        - include: full.yml
        - include: empty.yml
```

- task include "full.yml"
```yaml
---
  - shell: echo "Hello World"
    register: echo

  - debug:
      msg: "{{echo.stdout}}"
```

- task include "empty.yml"
```yaml
---
```

- run main playbook
```
ansible-playbook testblockwithempty.yml  --user=root --ask-pass
```

##### EXPECTED RESULTS

```
$ ansible-playbook testblockwithempty.yml  --user=root --ask-pass
SSH password: 

PLAY [all] *********************************************************************************************

TASK [Gathering Facts] *********************************************************************************
ok: [myhost]

TASK [command] *****************************************************************************************
changed: [myhost]

TASK [debug] *******************************************************************************************
ok: [myhost] => {
    "msg": "Hello World"
}

PLAY RECAP *********************************************************************************************
myhost                 : ok=3    changed=1    unreachable=0    failed=0   

$ 
```

##### ACTUAL RESULTS

```
$ ansible-playbook testblockwithempty.yml --user=root --ask-pass
SSH password: 

PLAY [all] *********************************************************************************************

TASK [Gathering Facts] *********************************************************************************
ok: [myhost]

PLAY RECAP *********************************************************************************************
myhost                 : ok=1    changed=0    unreachable=0    failed=0   

$
```

The behaviour doesn't change if the "block" is closed with ```when: true```


Discussion:

Resolving patch:
diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py
--- a/lib/ansible/playbook/helpers.py
+++ b/lib/ansible/playbook/helpers.py
@@ -207,7 +207,8 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
                     try:
                         data = loader.load_from_file(include_file)
                         if data is None:
-                            return []
+                            display.warning('file %s is empty and had no tasks to include' % include_file)
+                            continue
                         elif not isinstance(data, list):
                             raise AnsibleParserError("included task files must contain a list of tasks", obj=data)
 


Test patch: