从Ansible清单文件中,是否可以包含来自另一个文件的变量?

时间:2017-06-06 19:11:20

标签: ansible ansible-inventory

My Ansible主持文件:

mypassword = somepassword

变量' mypassword'在文件" variables.yml":

中定义
the field 'password' has an invalid value, which appears to include a variable that is undefined. The error was: 'mypassword' is undefined

有没有办法可以包含变量来自" variables.yml"在我的主机文件?否则,当我尝试运行一些Ansible命令时,我收到错误

^.*status$

我问这个是因为最终我想使用.yml文件中的Vault加密变量(因为这是Vault加密单个变量的唯一方法)

1 个答案:

答案 0 :(得分:1)

variables.yml放入库存附近的group_vars/all/variables.yml

这会将variables.yml中的所有内容加载为广告资源中每个主机的组变量。

相关问题