我有一个列表和一个with_items循环,我在列表中查看。我的问题是,当我查看列表时,如何将结果注册/附加到现有列表?我使用的是Ansible 2.0.1.0版。
我的清单:
channels:
channel1:
item1: 'value'
item2: 'value'
channel2:
item1: 'value'
item2: 'value'
循环:
- name: Do a shell command for each channel
shell: some command that returns a number with the help {{ item }}
with_items: "{{ channels }}"
register: channels.item3.result #?? not sure how to do this
执行debug var = channels时输出应该是什么:
channels:
channel1:
item1: 'value'
item2: 'value'
item3: 'result from shell command'
channel2:
item1: 'value'
item2: 'value'
item3: 'result from shell command'