【发布时间】:2019-06-21 15:38:51
【问题描述】:
我有两个可靠的事实,一个看起来像这样:
"ansible_facts": "int_table" {
"[{ "connection": "notconnected",
"port": "eth1"},
{ "connection": "connected",
"port": "eth2"}]"
和
"ansible_facts": "mac_table" {
"[{ "mac_address": "0000.c200.0101",
"port": "eth1"},
{ "mac_address": "0320.c500.0201",
"port": "eth2"}]"
我想创建一个新事实,通过端口将两者结合起来,以便输出
"ansible_facts": "new_table" {
"[{ "mac_address": "0000.c200.0101",
"connection": "notconnected",
"port": "eth1"},
{ "mac_address": "0320.c500.0201",
"connection": "connected",
"port": "eth2"}]"
纯ansible可以做到这一点吗?我尝试将两者都传递给自定义过滤器以使用 python 将两者结合起来,但似乎无法将两个事实传递给同一个过滤器。
【问题讨论】:
-
this 有帮助吗?