Variables and templates between roles

14 views
Skip to first unread message

Gabriel Forster

unread,
Feb 28, 2017, 10:32:43 AM2/28/17
to Ansible Project
I may be way off in the way I'm trying to accomplish this, but I think I need to pass variables from one role to another. 

I am setting up svn on a Suse server. I'm using the geerlingguy.apache and a rather modified geerlingguy.svn roles. I need the apache role available to deploy apache with various vhosts across a number of servers. So, my thought is that the vhosts should not be in the apache role, but in roles for the various different services that use apache, svn being one of them. So, I'd like to basically use the roles and templates from the apache role in the svn role. 

Alternatively, I think I would put all the various vhost configurations into the apache role and somehow determine which one goes on which server. Unsure how to do that. 

Looking for the best way forward since this idea will carry over into other roles as well and I want to get the structure correct.  Thanks!

Dick Davies

unread,
Feb 28, 2017, 1:23:45 PM2/28/17
to ansible list
If you load the apache role in a play and then your vhosts role, you should be
able to use apache role vars (or set in defaults/ ) in the vhosts role, so long
as both roles are in the same play.

(we just did exactly this this afternoon, so let me know if it's not happening
for any reason).
> --
> 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/980f29cf-829e-461c-8d8a-656155c79872%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages