So it looks like I've hit my first real blocker using ansible. I have eight environments currently and will be adding more in the future. I need to set defaults for certain vars, which may get overriden on a per environment basis. (using a seperate host file for each environment)I tried defining defaults in the /role/vars/main.yml, then overrride those via host file; unfortunately that works backwards. The role var overrides the var defined in all the host files.. which seems really strange to me, but maybe I am missing something.I really need a way to do this in a way that doesn't require every environment/host file to have every var in it.Is there a better way to do this?--
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.
For more options, visit https://groups.google.com/groups/opt_out.
On Tue, 11 Jun 2013 15:39:22 +0200, martin f krafft wrote:
Would you please be so kind as to enlighten me and help me understand your point of view, and why you (and others) might think that Ansible does it right?
I also think Ansible doesn't do it right, but that is the unintuitive way how you have to deal with variables here.
Greetings,
gw
Works for me, but I use single inventory and use group vars to handle envs.
Brian Coca
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
Hi,
On Thu, 13 Jun 2013 23:08:40 +0200, martin f krafft wrote:
1. some of us believe that a role's vars/main.yml file should define defaults at a very low level of precedence, i.e. *below* the inventory variables;
Sorry for bringing up the old thread, but what do you all think of introducing "vars_defaults"
in plays that would be similar to "vars_files", but would have either the lowest possible priority
(lower than "group_vars/all") or at least lower than "vars" (above all inventory variables)?
If roles would than (maybe configurable behavior), instead of "vars_files: .../vars/main.yml"
implicitly use "vars_defaults: .../vars/main.yml" this would solve all precedence issues. Or maybe
roles could implicitly use "vars_defaults: .../vars/defaults.yml" and "vars_files: .../vars/main.yml".
Use case for a couple of re-usable roles each with its own "vars/main.yml" that all define the same
variables and you want to override most of them would result in unnecessary large play, because
you need to specify role parameters over and over again. Eg.:
- hosts: xxx
roles:
- role: net_basic
net_name: thishostnamenet_domain: thisdomainnet_fqdn: thishostname.thisdomain
net_primary_ip: 1.2.3.4net_primary_netmask: 255.255.255.0- role: net_ifacenet_name: thishostnamenet_domain: thisdomainnet_fqdn: thishostname.thisdomain
net_primary_ip: 1.2.3.4net_primary_netmask: 255.255.255.0- role: net_iptablesnet_name: thishostnamenet_domain: thisdomainnet_fqdn: thishostname.thisdomain
net_primary_ip: 1.2.3.4net_primary_netmask: 255.255.255.0Wouldn't it be much cleaner to have the ability to use it as (or even putting the vars into inventory?):- hosts: xxx
vars:net_name: thishostnamenet_domain: thisdomainnet_fqdn: thishostname.thisdomain
net_primary_ip: 1.2.3.4net_primary_netmask: 255.255.255.0roles:- net_basic- net_iface- net_iptablesWhere in case you forget to specify anything the default from "vars/defaults.yml" kicks-in?Greetings,
gw