.actions
的列表,而不对响应列表进行硬编码。
有谁知道怎么做?
到目前为止我们的代码:
---
- 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 }}"