【发布时间】:2017-10-26 03:52:36
【问题描述】:
伙计们。我试图找到一个可行的答案,但失败了;
我们正在将 docker 映像加载到虚拟机中。我们想调试每个.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 }}"
【问题讨论】:
标签: filter ansible jinja2 docker-image