Re: [ansible-project] Re: How to share template between two roles?

267 views
Skip to first unread message

James Cammarata

unread,
Apr 8, 2015, 11:51:23 AM4/8/15
to ansible...@googlegroups.com
Roles are intended to be independent things, so sharing files between them doesn't make a lot of sense. One thing you could do, if these two roles are that similar, is to combine them into a single role and add a variable to defaults which set the mode, for instance "dbservers_mode: master". Then you could have something like this in your tasks/main.yml:

- include: "{{dbservers_mode}}.yml"

And then the master.yml/slave.yml files would be the tasks/main.yml from each of the individual roles.

Hope that helps!


James Cammarata
Director, Ansible Core Engineering
github: jimi-c

On Wed, Apr 8, 2015 at 2:47 AM, Ridho Adya Pangestu <ridh...@gmail.com> wrote:
streaming.yml

---
- hosts: dbservers-master
  sudo: yes
  roles:
    - configure-master

- hosts: dbservers-master
  sudo: yes
  roles:
    - configure-slave

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2c850615-2ed5-4219-9265-832f0ee3c81b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages