简体   繁体   中英

Ansible import/include variable definition from one of the group_vars to another

I need to import all variables defined in /environments/prod/group_vars/test1 to ./environments/prod/group_vars/test2 .


Suppose the content of test1 is as follows:

datacenter: ashburn 

I need the same to be on test2 .

似乎对于特定环境所需的公共变量,我们可以创建“ group_vars / all”文件,对于host_group相关变量,我们可以使用“ group_vars / test1”文件。

Create a new inventory group 'tests_common_vars' that has 'test1' and 'test2' as children:

[tests_common_vars:children]
test[1:2]

and put all the common variables in 'group_vars/tests_common_vars'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM