# playbook pause and tag madness!

**URL:** <https://forum.ansible.com/t/playbook-pause-and-tag-madness/17824>\
**Category:** Ansible Project\
**Created:** [March 24, 2015, 12:52am UTC](https://forum.ansible.com/t/playbook-pause-and-tag-madness/17824 "2015-03-24T00:52:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve\_Kieu](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Steve\_Kieu](https://forum.ansible.com/u/Steve_Kieu)\
**Post date:** [March 24, 2015, 12:52am UTC](https://forum.ansible.com/t/playbook-pause-and-tag-madness/17824/1 "2015-03-24T00:52:19Z")

</div>

Hi all,

Sorry for the rant but I get through this and think that with that matter ansible is quirky.

1. First roles with tags not work as expected (yes saw some post and people saying you need to agg at the command line

My play book like this

- name: ctn  
hosts: staging-web  
roles:
- { role: web\_base, tags: [‘install-php’] }

It executed who whole role no matter the tags is there.

1. Task and Roles unexpected behaviour.

Example I have

- name: DO something  
hosts: myhost  
tasks:
- pause:  
roles:
- web\_base

If doing like this the tasks and pause is not executed. The role is executed and I did not wait until role finsihed to see if the task is touched at all.

So I have to split them like this, but why do I need to?

- name: do something  
hosts: myhost  
task:

- pause:

- name: ditto  
hosts: myhost  
roles:

- myrole

Now it is not enough. The that playbook if I play without the options tags=XXX then it prompts me. But with teh option --tags=XXX then it does not pause me anymore, Why the --tags option affect how the playbook order of execution?

See be low is my playbook and if play without --tag=install-php then it prompts me to warn, But if I specified the tag it skip the prompt (pause) but then play everything rather than only this tags.

It is a mess!

cat update-php.yml

---

<div class="post-metadata">

**Author:** ![Steve\_Kieu](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Steve\_Kieu](https://forum.ansible.com/u/Steve_Kieu)\
**Post date:** [March 24, 2015, 12:57am UTC](https://forum.ansible.com/t/playbook-pause-and-tag-madness/17824/2 "2015-03-24T00:57:59Z")

</div>

Ironically If I remove the tags: [‘install-php’] in the role and then it behaves better that it only play that tags.

Again it still skip the pause for not any reason.

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [March 24, 2015, 7:28am UTC](https://forum.ansible.com/t/playbook-pause-and-tag-madness/17824/3 "2015-03-24T07:28:15Z")

</div>

Steve,

---

<div class="post-metadata">

**Author:** ![Martin2](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Martin2](https://forum.ansible.com/u/Martin2)\
**Post date:** [March 24, 2015, 8:15am UTC](https://forum.ansible.com/t/playbook-pause-and-tag-madness/17824/4 "2015-03-24T08:15:07Z")

</div>

Hi,

(Now this is just a theoretical point. Actually changing that stuff would probably break too much existing stuff)

actually I think there’s a point to the pre\_task,roles,post\_task stuff.

It makes perfect sense once you found that section in the docs, on the other hand one of the big promises of ansible is simplicity and (to me) a big point here is that the following seems reasonable and should just work:

# typing on a cell but you get the idea (hopefully)

name: play  
tasks:  
debug:  
msg: this runs first  
roles:

- {role\_that\_runs\_second}  
tasks:  
debug:  
msg: this runs last

/Martin

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [March 24, 2015, 8:19am UTC](https://forum.ansible.com/t/playbook-pause-and-tag-madness/17824/5 "2015-03-24T08:19:53Z")

</div>

​Well, it's YAML, and YAML translates that to a dictionary, and a  
dictionary is not ordered...​

There are limits to simplicity.

---

<div class="post-metadata">

**Author:** ![Martin2](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Martin2](https://forum.ansible.com/u/Martin2)\
**Post date:** [March 24, 2015, 10:20am UTC](https://forum.ansible.com/t/playbook-pause-and-tag-madness/17824/6 "2015-03-24T10:20:11Z")

</div>

I’m not talking about the underlying technical spec just that I understand the expectations of the OP.

Maybe a solution would be to put this information somewhere in the documentation where it is more visible?

regards,

Martin

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [March 24, 2015, 10:29am UTC](https://forum.ansible.com/t/playbook-pause-and-tag-madness/17824/7 "2015-03-24T10:29:13Z")

</div>

​Agreed, it might help to explain that the order in which you write the  
different tasks​ blocks, don't affect the execution order. Same for all  
yaml keys.

Might be a helpful patch on

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://docs.ansible.com/playbooks\_roles.html#roles](http://docs.ansible.com/playbooks_roles.html#roles)  
and/or  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[http://docs.ansible.com/YAMLSyntax.html](http://docs.ansible.com/YAMLSyntax.html)

&nbsp;&nbsp;&nbsp;&nbsp;Serge
