ansible 打印 ec2_tag 寄存器列表 [英] ansible print ec2_tag register list

查看:21
本文介绍了ansible 打印 ec2_tag 寄存器列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的任务,我得到了 ec2 实例 tgs我喜欢打印出返回值列表.

i have this simple task which i get ec2 instance tgs i like to print out the return list of values .

- name: get my tagging
  local_action:
    module: ec2_tag
    region: "{{ region }}"
    resource: "{{ instance_id }}"
    state: list
  register: my_ec2_tags
  tags:
    - spots

这不会给我任何价值

- name: Display all ec2_tags
  debug:
    var: my_ec2_tags
    verbosity: 3

如何打印 my_ec2_tags 的所有值,以便知道它是否设置正确?

how can i print all the values of my_ec2_tags so i could know if it was set right ?

推荐答案

似乎您在运行该剧时使用了标签.在这种情况下,您也应该标记您的调试任务.

Seems you are using tags while running the play. In that case, you should tag your debug task as well.

例如:

- name: Display all ec2_tags
  debug:
    var: my_ec2_tags.tags
  tags:
    - spots

这篇关于ansible 打印 ec2_tag 寄存器列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆