Hi all.
I have a master deployment playbook that more or less includes all of my
servers, which I use with tags to deploy only the apps/configs I want at
the time. Hosts are grouped into hostgroups by roles and each hostgroup has
it's own pre/post tasks for handling load-balancers, etc. It looks
something like this:
- hosts: tag_role_hostgroup1
serial: 1
pre_tasks:
- name: Remove from lb
...
tags: pre_tasks
roles:
- { role: app1, tags: app1 }
- { role: app2, tags: app2 }
post_tasks:
- name: Register to lb
...
tags: post_tasks
- hosts: tag_role_hostgroup2
serial: 1
pre_tasks:
- name: Some preps
...
tags: pre_tasks
roles:
- { role: app2, tags: app2 }
- { role: app3, tags: app3 }
post_tasks:
- name: Cleanup
...
tags: post_tasks
So far so good. It works pretty well as I can think about applications when
deploying, and each hostgroup will take care of itself regarding
load-balancers and all. Problem is when deploying for example app1 or app3.
In this case one play will have no roles selected, but since I'm including
"pre_tasks,post_tasks" as tags its pre/post tasks will still run, bringing
machines down and up again with no work done.
Do you have an idea of how to tackle this? I prefer to not create a
playbook per app as it's a lot less powerful and flexible. I was thinking
of making ansible run pre/post tasks only if some task in roles/tasks is
going to run, but that's kind of a last resort.
Thanks for Ansible, btw!
--
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/c0f38e58-db47-4e16-9fa0-c1c9c47b4e2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.