ansible - 需要获取语法来获取键值对
问题描述
TASK [hashi-bulk : pinting] ****************************************************
ok: [localhost] => {
"msg": [
"Pod000/windows:{'windows_password': 'Passw0rd!','windows_username': 'Administrator'}",
" Pod000/ad_cred : {'ad_password': 'Passw0rd!','ad_username': 'SANPADIEP230'}"
]
}
TASK [hashi-bulk : setin] ******************************************************
fatal: [localhost]: FAILED! => {"msg": "|combine expects dictionaries, got AnsibleUndefined"}
**I want the value Pod000/windows and Pod000/ad_cred as key and {'windows_password': 'Passw0rd!','windows_username': 'Administrator'} as value.**
- name: pinting
debug:
msg: "{{ var_json_secret }}"
- name: setin
set_fact:
secret: "{{ secret | default([]) | combine(dic[item]) }}"
with_items: var_json_secret
- name: test
debug:
var: secret
- 名称:保存调试:味精:“{{ item.key }}”循环:“{{查找('dict',var_json_secret)}}
在这里我想得到语法
解决方案
推荐阅读
- vlang - 如何分段读取二进制文件?
- python - 根据html选项修改python中的URL
- c# - 在实体框架中 EntityState.Detached 使操作变慢
- swift - 如何在登录页面上制作 firebase 验证凭据
- flutter - 扑。如何在 Sliver 中使用 SliverPersistentHeaderDelegate 管理状态?
- google-forms - 在谷歌表单确认页面上清除提交
- python - 谷歌的地理编码 API 关闭连接没有响应
- node.js - AWS Lambda 上的 Apollo Gateway 无法读取未定义的属性“内容类型”
- bash - Erlang 和 bash 脚本(escript)
- c# - 在 C# 中使用具有多个偏移量的指针