问题
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