I have got the following ansible directory layout
inventories/
group_vars/ # common variables production and staging
all
production/
hosts
group_vars/
all # common to all production
groupN.yml
host_vars/
all # common to all production
hostnameN.yml
staging/
hosts
group_vars/
all # common to all staging
groupN.yml
host_vars/
all # common to all staging
hostnameN.yml
site.yml
production.yml
staging.yml
roles/
docker/
defaults
# let's assume there defaults contain default_docker_version=a.b.c
tasks
...
webtier/
- My questions are:
- How do I override the values in roles/common/default using host specific values?
That is, I want to have the default value of roles specific to the environment.
Example I want production hosts to have docker version of x.y.z and staging have docker_version of a.b.c
I tried adding the variable to the host_vars - but ansible is still not able to find it.
- Is there an improvement on the structure layout that can be made?