Hi,

I had some trouble putting everything together with the ec2 module ...
with the help of the list I finally got it  working.

As Michael pointed out, with the ec2 module, it is easier to use complex 
arguments style.

This is a working example:

- hosts: 127.0.0.1
  connection: local
  gather_facts: True
vars:
...
  tasks:
      - name: create a vm
        local_action:
            module: ec2
            image: "{{ image }}"
            count: 1
            instance_type: "{{ instance_type }}"
            group: "{{ group }}"
            key_name: "{{ keypair }}"
            vpc_subnet_id: "{{ subnet }}"
            private_ip: "{{ ip }}"
            user_data: "{{ hostname }}.{{ dnsdomain }}"
            instance_tags: '{"Name":"{{ hostname }}"}'
            volumes:
                - device_name: /dev/sda1
                  volume_size: 10
                - device_name: /dev/sdb
                  ephemeral: ephemeral0
                - device_name: /dev/sdc
                  volume_size: 25
            wait: true
            wait_timeout: 500
            state: present
        register: ec2

Hope this help.

Fred

On Mar 4, 2014, at 05:03 , i iordanov <[email protected]> wrote:

> Hi guys,
> 
> I'm stuck with an issue and hoping somebody can spot my mistake. I have a 
> task like the following where I'm trying to specify a volume for the ec2 
> instance.
> 
>   tasks:
>     - name: Start instance
>       ec2: image=ami-xxxx
>            count=1
>            aws_access_key=xxx
>            aws_secret_key=yyy
> .
> .
>            volumes='{ "device_name":/dev/sdb, "volume_size":"10" }'
>            wait=true
> 
> No matter what syntax I try, ansible refuses to accept my specification. I 
> can't specify a single, let alone multiple volumes. Can anybody tell me what 
> the syntax should look like?
> 
> Many thanks!
> iordan
> 
> 
> -- 
> 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/08b3f198-f0fb-41ac-b909-d0e13b137db1%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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/E5187F1A-0601-4BCF-A9FE-325728D4EE31%40never-mind.ch.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to