我正在尝试在Ansible中运行命令,以便在我的网络中找到邻居:
- name: Get neighbors
junos_rpc:
rpc: "get-lldp-interface-neighbors"
output: 'xml'
args:
interface_device: A
register: net_topology
所以我的问题出在此任务中,我需要遍历列表并为interface_device提供另一个arg,并且每次都将结果也注册到另一个变量'net_topology'中。
- name: Get neighbors
junos_rpc:
rpc: "get-lldp-interface-neighbors"
output: 'xml'
args:
interface_device: "{{ item }}"
loop:
- A
- B
- C
register: net_topology
实际上,我所做的与上述类似,但是我只是以不同的方式传递了清单: