I encountered this recently. I solved it with group_vars and a simple trick in my hosts file:
#hostsfile localhost ansible_python_interpreter="/usr/bin/env python" ansible_connection=local [fancyapp-blue] localhost [fancyapp-violet] localhost ##end hostsfile Then, in my groupvars/fancyapp-blue and groupvars/fancyapp-violet, I override the role defaults. I make calls to specific "environments" like - hosts: fancyapp-blue gather_facts: no roles: - asg In this case, the group vars for fancyapp-blue will override the role defaults for asg. You could also do some neat things like applying the same role against groups of hosts, if you wanted to create things in parallel. On Thursday, August 7, 2014 10:18:34 AM UTC-7, Jesse Keating wrote: > > I’ve got a situation where I’m applying roles to a system locally, much in > the style of ansible-pull. The role has a number of defaults, but I wish to > override those defaults with custom details specific to this particular > environment. My wish is to provide those overrides via an external file to > the role, something we can iterate on without having to change the role > code itself (as it is distributed through a different method). > > I’m looking for ideas on how to make this work. I had originally thought > to make use of ansible local facts, in /etc/ansible/facts.d/*.fact files > However that results in variables named > ansible.local.<filename>.<blockname>.<key> which obviously cannot override > a role default as-is. > > Any thoughts you all might have would be appreciated! > > -jlk > > -- 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/6e5946d1-d8cd-4dce-95f2-5954e37c6e3d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
