扩展角色变量Ansible

问题描述

我正在扮演Ansible角色。在这个角色中,我有vars / main.yml文件。在同一目录中,我想使用包含secret加密变量的“ secret.yml”文件。从“ secret.yml”中提取角色范围变量的“ main.yml”文件的语法是什么?

secret.yml内容:

---
var1: value1
var2: value2

我尝试过:

main.yml内容:

---
- name: Pull variables
  include_vars: secret.yml

错误:

→ ./test_deploy.sh
ERROR! failed to combine variables,expected dicts but got a 'dict' and a 'AnsibleSequence':
{}
[{"name": "Pull variables","include_vars": "secret.yml"}]

main.yml内容:

---
- include: secret.yml

错误:

→ ./test_deploy.sh
ERROR! failed to combine variables,expected dicts but got a 'dict' and a 'AnsibleSequence':
{}
[{"include": "secret.yml"}]

Ansible甚至允许这种导入吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)