Reputation: 20470
In this snippet from my Ansible Playbook, I am tagging the EC2 instance itself in the instance_tags
section, but is there any way that I can tag the created volumes?
In the docs (http://docs.ansible.com/ansible/latest/ec2_module.html), it seems the answer is no, but I wanted to ask here to make sure.
tasks:
- name: EC2 Instance
ec2:
aws_access_key: <hidden>
aws_secret_key: <hidden>
instance_type: c4.4xlarge
image: ami-221ea342
monitoring: yes
region: us-west-2
wait: yes
volumes:
- device_name: /dev/xvda
volume_type: gp2
volume_size: 80
- device_name: /dev/xvdf
volume_type: gp2
volume_size: 500
exact_count: 2
count_tag:
Component: "MyEC2"
Environment: Production
<snip>
instance_tags:
Component: "MyEC2"
Environment: Production
<snip>
Upvotes: 1
Views: 310
Reputation: 141
You could achieve this if you switched to using Terraform instead of Ansible to create the AWS resources.
Upvotes: 1