ansible print ec2_tag register list

丶灬走出姿态 提交于 2021-01-29 16:49:13

问题


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

this don't print me any value

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

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


回答1:


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

E.g.:

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


来源:https://stackoverflow.com/questions/62388227/ansible-print-ec2-tag-register-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!