>From Ansible doc <http://docs.ansible.com/playbooks_roles.html#introduction>
:

Roles in Ansible build on the idea of include files and combine them to *form 
> clean, reusable abstractions*


I really want to love roles and use them extensively in our system, but so 
far I'm getting a heap of frustration instead. I am trying to position 
Ansible at work as the preferred automation platform to manage a complex 
system with several internally developed apps, plus db, web server, and 
more. (together this is one product/system) Multiple environments too, as 
usual.

I'd think it makes sense to have roles like:
- appX (for X in 1 through N)
- web
- db
- etc (more.. skipped)

One seemingly basic thing I need to do is to restart this entire system 
occasionally. I would like to use Ansible to do that. Here's a simplified 
pseudo-code recipe of a playbook:
- web.startMaintenance()
- app1.stop()
- app2.stop()
- app2.start()
- app1.start()
- web.endMaintenance()

*I want to run a single playbook command to do this.* That seems clearly 
possible with include files but not possible with roles. The following 
doesn't work:

ansible-playbook --tags 
"app1.stop,app1.start,app2.start,app2.stop,web.startMaintenance,web.endMaintenance"
 
playbooks/testRoleDeps.yml

That doesn't work because all plays in the playbook are filtered by the 
tags provided, and each play needs to have a particular tag applied (first 
stop *then* start later), not all of them.

My conclusion? *As of 1.8.4, roles are inadequate for complex playbooks and 
include files need to be used instead.*

That's unfortunate for code reuse reasons, etc. I would love to hear that 
this is not the case and I have overlooked something. Maybe a feature to 
resolve this is in the release plan?

I can't figure out how to do this even after reading the documentation 
repeatedly, reading the ansible O'Reilly book (pre-release copy), the code 
in ansible-examples, and various other resources.

-- 
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/8df62499-291c-4ffc-b380-b35b85ab7dde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to