February 2018
Intermediate to advanced
200 pages
5h 51m
English
To create an EBS volume, we can use an ec2_vol module. This will take the device name, the instance ID, the volume size, and the tag name as input parameters:
- name: Create EBS volume and attach to Instance ec2_vol: aws_access_key: "{{ access_key }}" aws_secret_key: "{{ secret_key }}" region: "{{ aws_region }}" instance: "{{ item }}" volume_size: 10 name: Public Instance 1 device_name: /dev/xvdf with_items: "{{ ec2_public_instance.instance_ids }}" register: ec2_volThis task will create an EBS volume with the tag name as Public Instance 1 and size 10 GB. Once the EBS volume is ready, it will be attached to the EC2 instance we provided with the device name /dev/xvdf.
We should note here that in this task, name and device_name ...
Read now
Unlock full access