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.
2. 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
---
# ansible quirks. If you set tasks and then add roles section after that
the tasks is not executed, only roles. Thus no pausing happened. To fix
need another play and specify the roles. The tags in role does not do
anything, still need to put --tags=XX at commandline.
- name: Update PHP to latest version on remi repo. You need to run this
play book with option --tags=install-php other than that it will replay the
whole playbook
hosts: staging-web
tasks:
- pause: prompt='*** WARNING *** You need to run this play book with
option --tags=install-php other than that it will replay the whole
playbook. Abort now if you forgot' minutes=10
- name: ctn
hosts: staging-web
roles:
- { role: web_base, tags: ['install-php'] }
# vim:expandtab ts=2 sw=2
Anyone please let me know what I do wrong or thinking wrongly (not the way
ansible thinks - Or is it a bug/features??)
Please....
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/1c45c311-6334-4523-9d7f-c6129e8aa036%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.