I discovered you volume_size is also optional when using ephemeral option 
here, it will default to the maximum size of the instance type spec.

On Thursday, August 21, 2014 at 9:01:49 AM UTC-4, Mike Buzzetti wrote:
>
> I just came across this. 
>
> I did something like this for a c3.xlarge. Setting the ephemeral number is 
> the trick (The ssds are considered ephemeral when part of the instance 
> store)
>
>
> volumes:
>   - device_name: /dev/xvdb
>     volume_size: 40
>     device_type: gp2
>     ephemeral: ephemeral0
>   - device_name: /dev/xvdc
>     volume_size: 40
>     device_type: gp2
>     ephemeral: ephemeral1
>
>
>
> On Tuesday, June 17, 2014 4:09:01 PM UTC-4, Dan Vaida wrote:
>>
>> Hello again,
>>
>> I managed to resize the root device by adjusting the volumes parameter 
>> like so:
>> volumes:
>>       - device_name: /dev/sda
>>         volume_size: 20
>>         device_type: gp2
>>
>> Hint was found here: New SSD-Backed Elastic Block Storage 
>> <http://aws.amazon.com/blogs/aws/new-ssd-backed-elastic-block-storage/>
>>
>> Now the only question that remains is: how to add those two SSD drives as 
>> well?
>>
>> Cheers!
>>
>> On Tuesday, 17 June 2014 12:44:54 UTC+2, Dan Vaida wrote:
>>>
>>> Hello everyone!
>>>
>>> Here goes my first post in the wonderful Ansible project :)
>>>
>>> Here's the problem that I am facing: I am trying to launch an EC2 
>>> instance (c3.2xlarge) and, in the process, I want to resize the root 
>>> partition from 8GB to something bigger. Also while in the process of 
>>> launching the instance, I'd like to add those two extra disks (2x80GB SSD) 
>>> that come with this instance.
>>>
>>> I do not know if this is even achievable via Ansible.
>>>
>>> So far, I looked at these two modules:
>>> - http://docs.ansible.com/ec2_module.html
>>> - http://docs.ansible.com/ec2_vol_module.html
>>>
>>> I played with them in different ways, with no avail. Here is what I have 
>>> now to successfully launch the instance. Playbook: provision.yml
>>> ---
>>> # http://docs.ansible.com/ec2_module.html
>>> - name: spin up the all in one instance
>>>   hosts: localhost
>>>   connection: local
>>>   gather_facts: False
>>>   tasks:
>>>
>>>   - name: create security group
>>>     local_action:
>>>       module: ec2_group
>>>       name: "{{ security_group }}"
>>>       description: security group for the all in one server
>>>       region: "{{ region }}"
>>>       vpc_id: "{{ vpc_id }}"
>>>       rules:
>>>         - proto: all
>>>           from_port: 0
>>>           to_port: 65535
>>>           cidr_ip: 87.193.177.242/32
>>>       rules_egress:
>>>         - proto: all
>>>           from_port: 0
>>>           to_port: 65535
>>>           cidr_ip: 0.0.0.0/0
>>>     register: ec2_group
>>>     tags: provisioning
>>>
>>>   - name: launch instance
>>>     local_action:
>>>       module: ec2
>>>       aws_access_key: "{{ ec2_access_key }}"
>>>       aws_secret_key: "{{ ec2_secret_key }}"
>>>       count: 1
>>>       region: "{{ region }}"
>>>       zone: "{{ zone }}"
>>>       instance_type: "{{ instance_type }}"
>>>       image: "{{ ami }}"
>>>       ebs_optimized: yes
>>>       state: present
>>>       group: "{{ security_group }}"
>>>       vpc_subnet_id: "{{ subnet }}"
>>>       key_name: "{{ keypair }}"
>>>       monitoring: yes
>>>       assign_public_ip: yes
>>>       wait: yes
>>>       wait_timeout: 300
>>>       volumes:
>>>       - device_name: /dev/xvda
>>>         volume_size: 20
>>>     register: ec2
>>>  # - name: adding remaining disks #(c3.2xlarge has 2x80GB SSD)
>>>  #   local_action: ec2_vol instance={{ item.id }} volume_size=80 count=2
>>>  #   with_items: ec2.instances
>>>  #   register: ec2_vol
>>>
>>> And for what it's worth, here are my variables host_vars/localhost:
>>> #AWS wheezy AMI IDs => 
>>> https://wiki.debian.org/Cloud/AmazonEC2Image/Wheezy
>>> #(EU-West-1, PVM, EBS-backed, x86_64)region: eu-west-1
>>> zone: eu-west-1a
>>> instance_type: c3.2xlarge
>>> ami: ami-630fcb14
>>>
>>> #network & security
>>> security_group: allinone
>>> subnet: subnet-ddca27aa
>>> vpc_id: vpc-9037d9f5
>>> keypair: ansible-ec2
>>>
>>> You can see how I tried and shamefully failed to add those two SSDs 
>>> (count parameter is not even supported by module ec2_vol) :)
>>> Curiously enough, if I use the volumes parameter of the module ec2 as 
>>> above, I get two EBS volumes showing up in the AWS console: /dev/sda and of 
>>> course /dev/xvda (this one being the root device). I cannot even see 
>>> /dev/sda in the EC2 instance.
>>> FYI, this AMI launches with a 8GB root partition by default. Would be 
>>> great if I could make that bigger with an Ansible module/parameter. I am 
>>> very much aware on how to do this "outside" of Ansible, but it's not 
>>> desired.
>>> Second issue would be attaching those two disks that come with this 
>>> instance type...
>>>
>>> Any help/hint would be greatly appreciated.
>>>
>>> See attached screenshot to better understand what I'm trying to achieve 
>>> with Ansible.
>>>
>>> Thank you Michael for this great tool!! 
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e50f5195-b073-4d80-806f-3199f078763d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to