我的目录布局如下
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/
- 我的问题是:
-如何使用主机特定的值覆盖role / common / default中的值?
也就是说,我想要具有特定于环境的角色的默认值。
示例我希望生产主机具有x.y.z的docker版本,并且暂存具有a.b.c的docker_version
我尝试将变量添加到host_vars中-但是ansible仍然找不到它。
-可以进行的结构布局有改进吗?