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 in Ansible by Latchu
• 380 points
568 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 by Kalgi
• 42,430 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

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,620 points
131 views
0 votes
1 answer

How to remove cron using Ansible

Hey @Likhit, You could use something like ...READ MORE

answered Jan 28 in Ansible by Kavya
435 views
0 votes
1 answer

How to encrypt and existing file using Ansible Vault?

Hey @Kyraa, to encrypt an existing file ...READ MORE

answered Jan 29 in Ansible by Kavya
582 views
0 votes
1 answer
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
215 views
0 votes
1 answer
0 votes
1 answer