I use a different approach,
root
├── inventory
│ |-- dev
│ │-- vagrant
│ │-- preprod
│ └── production
|
└── group_vars
|
|-- all.yaml
|-- dev/
| |-- secrets.yaml
|
|-- vagrant/
| |-- secrets.yaml
|
|-- preprod/
| |-- secrets.yaml
|
|-- production/
|-- secrets.yaml
where my group_vars/all.yaml contains all my definitions for every
environment, I keep it DRY by using lots of yaml anchors/aliases.
https://github.com/Azulinho/ansible-jenkins-showcase/blob/master/group_vars/all.yaml#L686
And in my inventory files, I set a variable 'deploy_env'
https://github.com/Azulinho/ansible-jenkins-showcase/blob/master/vagrant
I consume that 'deploy_env' variable (typically matches my inventory file)
at the end of my group_vars/all.yaml file.
https://github.com/Azulinho/ansible-jenkins-showcase/blob/master/group_vars/all.yaml#L713
there are a gazillion ways of doing it, this one works well for me.
On Thursday, December 18, 2014 5:54:22 PM UTC, Trevor Hartman wrote:
>
> You're right, adding group_vars/all was my own attempt at providing
> site-wide defaults that could be overriden at the env level.
>
> So it sounds like I need a way to provide site-wide defaults at the
> Inventory level instead of Play level. I have an idea to manually load a
> defaults file with my dynamic inventory script and setting those vars, but
> it's a bit ugly.
>
> On Tuesday, December 16, 2014 3:26:38 PM UTC-7, Brian Coca wrote:
>>
>> i think the example you posted/followed is a bit confusing because
>> their play is named group_vars.yml, it does not have an actual
>> group_vars dir at play level.
>>
>>
>>
>> --
>> 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 [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/4c6661a4-3a86-47b7-8cdc-69c638cbb00c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.