【发布时间】:2020-06-17 07:50:19
【问题描述】:
Ansible 剧本:
---
- task:-
- code goes here
- name: Trying to get instance Private IP from ASG
ec2_instance_facts:
instance_ids:
- "{{ item }}"
with_items: "{{ INSTANCE_IDS_FROM_ASG }}"
register: instance_ids_result
- set_fact:
msg: "{{ instance_ids_result | json_query('results[*].instances[*].network_interfaces[*].private_ip_address') }} "
- debug: var=msg
我的输出如下:
ok: [localhost] => {
"msg": [
[
"172.31.144.74"
],
[
"172.31.147.69"
]
]
}
但是,我需要列表中的输出为["172.31.144.74", "172.31.147.69"] 或"172.31.147.69" "172.31.147.69"。
以这种方式打印它的最佳方法是什么?
【问题讨论】:
标签: linux automation ansible