How to increase aws ebs volume using ansible

0 votes
I would like to increase my aws ebs which is currently running. Its ubuntu 16 which having 30 harddisk. Now I need to increase upto 50 gb. How to create ansible playbook to increase hard disk? Is possible? If any one have sample playbook kindly provide me. It will be helpful. Thanks.
Sep 9, 2019 in Ansible by Lakshminarayanan
• 1,370 points
5,075 views

1 answer to this question.

0 votes

Hey, I am unaware of any specific parameter that lets you resize an already attached volume. But You can use the command module to execute a CLI command and change the elb volume size.

 - name: resize elb volume
      command: >
       aws ec2 modify-volume --volume-type io1 --iops 10000 --size 50 --volume-id vol-11111111111111111 
answered Sep 9, 2019 by Kalgi
• 52,350 points
Many Thanks Kalgi. I will check and update you.
Cool, let me know! :)
i have tried kalgi. But its creating 8 gb harddisk and attached to that instance as /dev/sdf secondary volume in that instance. Can't we resize same volume ? kalgi. below is my playbook. its confusing too. but its creating 8gb harddisk and it attache to same instance as secondary disk (/dev/sdf).

---
- hosts: localhost
  connection: local
  become: yes
  gather_facts: no
  vars:
    region: us-east-1
    az: us-east-1c
    volumesize: 8
    instance_id: i-xxxxxxxxx
  tasks:
    - name: To Get Volume-Id
      command: "aws ec2 describe-volumes
                --region us-east-1
                --filters Name=attachment.instance-id,Values=i-xxxxxxxxxx Name=attachment.delete-on-termination,Values=true
                --query 'Volumes[*].VolumeId' --output text"
      register: volumeid

    - name: To Increase a Volume Size
      ec2_vol:
        instance: "{{ instance_id }}"
        region: "{{ region }}"
        #id: "{{ volumeid.stdout }}"
        zone: "{{ az }}"
        volume_size: "{{ volumesize }}"
      when: volumeid.stdout!="None"

i tried lot. But i will try again and however find the solution .

Related Questions In Ansible

0 votes
1 answer

How to create a key pair on AWS using Ansible-Playbook?

Hi@akhtar, You can find the ec2_key module in ...READ MORE

answered Aug 12, 2020 in Ansible by MD
• 95,460 points
1,478 views
0 votes
1 answer

How to create a security group in AWS using Ansible-Playbook?

Hi@akhtar, You can use the ec2_group module in ...READ MORE

answered Aug 13, 2020 in Ansible by MD
• 95,460 points
3,853 views
0 votes
1 answer

How to create docker volume using Ansible?

Hi@akhtar, We can create a volume docker resource ...READ MORE

answered Sep 20, 2020 in Ansible by MD
• 95,460 points
2,607 views
0 votes
1 answer

How to create an encrypted bucket in AWS using Ansible Playbook?

Hi@akhtar, Sometimes it is required to encrypt the ...READ MORE

answered Dec 4, 2020 in Ansible by MD
• 95,460 points
821 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,064 views
+2 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP