Author: | Lester Wade |
---|
New in version 1.1.
creates an EBS volume and optionally attaches it to an instance. If both an instance ID and a device name is given and the instance has a device at the device name, then no volume is created and no attachment is made. This module has a dependency on python-boto.
parameter | required | default | choices | comments |
---|---|---|---|---|
aws_access_key | no | None | AWS access key. If not set then the value of the AWS_ACCESS_KEY environment variable is used. | |
aws_secret_key | no | None | AWS secret key. If not set then the value of the AWS_SECRET_KEY environment variable is used. | |
device_name | no | device id to override device mapping. Assumes /dev/sdf for Linux/UNIX and /dev/xvdf for Windows. | ||
ec2_url | no | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Must be specified if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used | ||
instance | no | instance ID if you wish to attach the volume. | ||
iops | no | 100 | the provisioned IOPs you want to associate with this volume (integer). (added in Ansible 1.3) | |
region | no | The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used. | ||
snapshot | no | snapshot ID on which to base the volume | ||
validate_certs | no | yes |
|
When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. (added in Ansible 1.5) |
volume_size | yes | size of volume (in GB) to create. | ||
zone | no | zone in which to create the volume, if unset uses the zone the instance is in (if set) |
Note
Requires boto
# Simple attachment action
- local_action:
module: ec2_vol
instance: XXXXXX
volume_size: 5
device_name: sdd
# Example using custom iops params
- local_action:
module: ec2_vol
instance: XXXXXX
volume_size: 5
iops: 200
device_name: sdd
# Example using snapshot id
- local_action:
module: ec2_vol
instance: XXXXXX
snapshot: "{{ snapshot }}"
# Playbook example combined with instance launch
- local_action:
module: ec2
keypair: "{{ keypair }}"
image: "{{ image }}"
wait: yes
count: 3
register: ec2
- local_action:
module: ec2_vol
instance: "{{ item.id }} "
volume_size: 5
with_items: ec2.instances
register: ec2_vol