I also have the need to set environment specific role defaults.
I am using include_vars for this purpose which works fine as long as you
don't want to overwrite some of this role default variables via host_vars.
Because that is not going to work, because host_vars are overwritten by
included var
Well, sort of, but unfortunately, no :)
While the default does control what variable gets loaded with "set_fact"
(this could have been done without the default) it is still going to get
loaded at a level that is not the same as defaults, so inventory can't
override what you have loaded there.
I'd
On 28/04/14 23:01, Matt Willsher wrote:
> Hi,
>
> I'm trying to write generic roles for particular applications and keep
> hitting across the same problem:
>
> I want to set role default based on the operating system or other
> facts, like include_vars, but this doesn't appear to be supported.
>
>
This is true, it's also intentional to avoid facts clobbering explicitly
set variables. But it's all around the same ballpark.
No, we are not adding any kind of "default_vars" module.
This doesn't even make sense as a module as "defaults/" in a roles
directory is processed by core code, it's not
In the docs on precedence, discovered facts come under inventory but the
include_vars facts are actually higher precedence than the inventory.
Being able to have a default_vars module would, I maintain, be a boon for
reusable roles. They can be less opinionated and fit more circumstances. It
allow
these variables are facts -- they override inventory variables because they
are at the same depth and are loaded later
On Tue, Apr 29, 2014 at 10:05 AM, Matt Willsher wrote:
>
> Testing on 1.5.5 they appear at the level of "most everything else" - a
> variable defined in a include_vars file
Testing on 1.5.5 they appear at the level of "most everything else" - a
variable defined in a include_vars file overrides an inventory variable. If
they were at the level of facts, that would be great and would all default
like behaviour and overriding by more environment specific data.
On 29 Apr
include_vars creates fact scoped variables.
Sorry, you're not going to be able to get it to work every which sort of
different way.
I would not assume OS specific defaults *or* instead just put hosts in a
group based on the OS, if you really need that capability, and then could
use group_vars/ fi
I'd like the included vars injected with the same precedence as those in
defaults/main.yml rather than the precedence of vars/main.yml. The
documentation is not clear on the what precendence include_vars get.
>From my testing, vars coming from include_vars have a higher precedence
than inventory
I'm a little confused by this because you seem to be saying a feature isn't
supported that is actually part of Ansible, but it's actually a module
already in Ansible:
http://docs.ansible.com/include_vars_module.html
It also works with the "when" operator for per-OS variant usage.
Were you perhap
Hi,
I'm trying to write generic roles for particular applications and keep
hitting across the same problem:
I want to set role default based on the operating system or other facts,
like include_vars, but this doesn't appear to be supported.
The only option I see practically available for templ
11 matches
Mail list logo