Syntax of "device_name" for ec2 module

711 views
Skip to first unread message

Jody McIntyre

unread,
Jan 30, 2015, 11:17:14 AM1/30/15
to ansibl...@googlegroups.com
Hi,

I've been trying to change the size of my root partition when provisioning with the ec2 module.  The documentation isn't clear on what to do here, and I'm seeing some very strange results.  I tried a bunch of possible device names to see what happened.  Here's the playbook:

- name: temp
  hosts: localhost
  connection: local
  gather_facts: False
  tasks:
   - name: Launch/check temp
     local_action:
       module: ec2
       id: "prod-temp-{{ item.n }}"
       key_name: prod-2015
       image: ami-9eaa1cf6    # ubuntu 14.04 64bits
       instance_type: t2.small
       group_id: sg-cd72a9a9
       instance_tags: {"Name": "prod-temp-{{ item.n }}"}
       assign_public_ip: yes
       vpc_subnet_id: subnet-1f76e168
       volumes:
         - device_name: "{{ item.dev }}"
           volume_size: 123
       region: us-east-1
       zone: us-east-1c
     with_items:
       - { n: "001", dev: "/dev/sdb" }
       - { n: "002", dev: "/dev/sdb1" }
       - { n: "003", dev: "sdb" }
       - { n: "004", dev: "/dev/sda" }
       - { n: "005", dev: "/dev/sda1" }
       - { n: "006", dev: "sda" }
       - { n: "007", dev: "/dev/xvda" }
       - { n: "008", dev: "/dev/xvda1" }
       - { n: "009", dev: "xvda" }

The results from running this:

/dev/sdb: The root filesystem ends up being 8 GB on xvda1.  xvdb exists with size 128 GB.
/dev/sda1: The root filesystem ends up being 123 GB on xvda1 (which is what I wanted, but strange that "sda1" turns into "xvda1").
/dev/xvda: The root filesystem ends up being 8 GB on xvda1.  No other block devices exist (other than xvda of course, at 8 GB).
xvda: The root filesystem ends up being 8 GB on xvda1.  No other block devices exist (other than xvda of course, at 8 GB).

All others give an error of the form:
msg: Instance creation failed => InvalidBlockDeviceMapping: Invalid device name /dev/xvda1

Can anyone explain what's going on here?

Thanks,
Jody

Giovanni Tirloni

unread,
Feb 2, 2015, 6:38:52 AM2/2/15
to ansibl...@googlegroups.com
On Fri, 30 Jan 2015 08:17 -0800, Jody McIntyre <jo...@plot.ly> wrote:
> Hi,
>
> I've been trying to change the size of my root partition when
> provisioning
> with the ec2 module. The documentation isn't clear on what to do here,
> and
> I'm seeing some very strange results. I tried a bunch of possible device
> names to see what happened. Here's the playbook:

I haven't had the need but it looks like you need to specify "/dev/xvda"
to change the root volume.

See if this answer helps: http://bit.ly/1zunCOK

Giovanni

Jody McIntyre

unread,
Feb 2, 2015, 11:58:15 AM2/2/15
to Giovanni Tirloni, ansibl...@googlegroups.com
I found that answer while troubleshooting my problem but it didn't really help - I'm confused by what's going on in the accepted answer but I'm not using variables to set the volumes information, rather the volume information is part of the task that createes the machine.

It looks like it worked for the SO poster with "/dev/xvda", but in my case that gave a root filesystem of 8 GB not 123 GB as requested, with no additional block devices.  In my case "/dev/sda1" was the only thing that allowed be to change the size of the root filesystem, which I don't understand at all (and there's almost no documentation on "volumes" at http://docs.ansible.com/ec2_module.html .

Cheers,
Jody


--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-devel/cqTKQWHpjrs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-deve...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages