0
何傢伙。我試圖找到一個有效的答案,但失敗了; 我們正在加載docker image sinto a vm。我們希望調出每個列表的.actions
,而不用硬編碼響應列表。 有誰知道如何?試圖過濾一個with_item結果是可靠的
這裏是我們到目前爲止的代碼:
---
- name: 'Debbug images to pull'
debug:
var: required_images
- name: 'Pull docker images so that we have them pre-loaded'
docker_image:
name: "{{ item.image_name }}:{{ item.image_version }}"
state: 'present'
with_items: "{{ required_images }}"
register: docker_pull_output
- name: 'Confirm images pulled attempt a - this looks righ tbut has the array length hard coded'
debug:
var: item
verbosity: 2
with_items:
- "{{ docker_pull_output.results[0].actions }}"
- "{{ docker_pull_output.results[1].actions }}"
- "{{ docker_pull_output.results[2].actions }}"
- "{{ docker_pull_output.results[3].actions }}"
- "{{ docker_pull_output.results[4].actions }}"
- name: 'Confirm images pulled attempt b - this spams us with the full item, not just the .action property'
debug:
var: item.actions
verbosity: 2
with_items: "{{ docker_pull_output.results }}"
超,謝謝!我現在試試吧... –