# Script ending after first include statement

**URL:** <https://forum.ansible.com/t/script-ending-after-first-include-statement/23898>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [March 6, 2017, 9:46pm UTC](https://forum.ansible.com/t/script-ending-after-first-include-statement/23898 "2017-03-06T21:46:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brik\_Royster](https://avatars.discourse-cdn.com/v4/letter/b/aeb1de/32.png) [@Brik\_Royster](https://forum.ansible.com/u/Brik_Royster)\
**Post date:** [March 6, 2017, 9:46pm UTC](https://forum.ansible.com/t/script-ending-after-first-include-statement/23898/1 "2017-03-06T21:46:40Z")

</div>

Hi all, I have a script here with some weird behaviors that I can’t really explain.

The general layout of the script looks like this:

`

- hosts: ‘localhost’  
tasks:
- name: ‘launch AWS environment’  
cloudformation:  
stack\_name: ‘{{ env }}’ # env is environment name, passed in via extra\_vars

# …

# this script waits for SSH to come up on instances, adds IPs to known hosts, etc. based off {{ env }}

# this script also calls an ec2.py refresh to make sure future host blocks can find the appropriate instances

- include: ‘touch.yml’

# these hosts definitely exist at this point

- hosts: ‘tag\_environment\_{{ env }}’

# do some provision work

`

For some reason, the script will properly create the environment in the first host block, then do all of the contents of touch.yml without any errors, but then it simply ends. I don’t even see a “no hosts matched” for the last host block. It’s like it didn’t try it at all.

Is something wrong with this syntax or is there a bug here?

Cheers,  
Brik

---

<div class="post-metadata">

**Author:** ![Josh\_Smift1](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Josh\_Smift1](https://forum.ansible.com/u/Josh_Smift1)\
**Post date:** [March 7, 2017, 2:15pm UTC](https://forum.ansible.com/t/script-ending-after-first-include-statement/23898/2 "2017-03-07T14:15:04Z")

</div>

> For some reason, the script will properly create the environment in  
> the first host block, then do all of the contents of touch.yml without  
> any errors, but then it simply ends. I don't even see a "no hosts  
> matched" for the last host block. It's like it didn't try it at all.

I wonder if this is somehow related to  
[https://github.com/ansible/ansible/issues/20736](https://github.com/ansible/ansible/issues/20736) , which shows similar  
symptoms, although the \*workaround\* there seemed to be to use includes  
instead of blocks, so perhaps not. But this thing where it just silently  
ignores some tasks is weird.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-Josh (jbs@care.com)

(apologies for the automatic corporate disclaimer that follows)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

---

<div class="post-metadata">

**Author:** ![Brik\_Royster](https://avatars.discourse-cdn.com/v4/letter/b/aeb1de/32.png) [@Brik\_Royster](https://forum.ansible.com/u/Brik_Royster)\
**Post date:** [March 7, 2017, 4:38pm UTC](https://forum.ansible.com/t/script-ending-after-first-include-statement/23898/3 "2017-03-07T16:38:52Z")

</div>

Hmm, it could be related. If anything, that workaround might be enough for me now.
