Add more example on how to use module ec2_tags to list tags on an ins… (#3530)
* Add more example on how to use module ec2_tags to list tags on an instance * Add more example on how to use module ec2_tags to list tags on an instance
This commit is contained in:
parent
3775d8e684
commit
0fcc2d8973
1 changed files with 16 additions and 0 deletions
|
@ -107,6 +107,22 @@ tasks:
|
||||||
with_subelements:
|
with_subelements:
|
||||||
- ec2_vol.results
|
- ec2_vol.results
|
||||||
- volumes
|
- volumes
|
||||||
|
|
||||||
|
# Playbook example of listing tags on an instance
|
||||||
|
tasks:
|
||||||
|
- name: get ec2 facts
|
||||||
|
action: ec2_facts
|
||||||
|
|
||||||
|
- name: list tags on an instance
|
||||||
|
ec2_tag:
|
||||||
|
region: "{{ ansible_ec2_placement_region }}"
|
||||||
|
resource: "{{ ansible_ec2_instance_id }}"
|
||||||
|
state: list
|
||||||
|
register: ec2_tags
|
||||||
|
|
||||||
|
- name: list tags, such as Name, env if exist
|
||||||
|
shell: echo {{ ec2_tags.tags.Name }} {{ ec2_tags.tags.env }}
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue