Hi Max, 

Are you running this playbook with the ec2 instance as the remote target? 

You are missing the reference to the registered fact, I think:

  - name: gather ec2 facts
      action: ec2_facts
      register: ec2_facts
 
   - debug: var=ec2_facts
 
   - name: Add volume for cassandra nodes
     local_action:
       module: ec2_vol
       instance: "{{ *ec2_facts.*ansible_ec2_instance_id }}"
       volume_size: 50
       volume_type: gp2
       region: us-east-1
       device_name: /dev/xvdb

I haven't used the ec2_facts module yet myself, however, since I usually 
provision and register facts from the ec2 module, so I might be wrong. 

Joanna

On Thursday, July 21, 2016 at 11:50:26 AM UTC-5, Max León wrote:
>
> Hi,
> I'm trying to create a playbook that will attach a volume to the specified 
> instances and install casssandra as a cluster.
>
> I have almost everything worked out but the ec2_vol part.
>
>  # tasks file for cassandra
>    - name: gather ec2 facts
>       action: ec2_facts
>       register: ec2_facts
>  
>    - debug: var=ec2_facts
>  
>    - name: Add volume for cassandra nodes
>      local_action:
>        module: ec2_vol
>        instance: "{{ ansible_ec2_instance_id }}"
>        volume_size: 50
>        volume_type: gp2
>        region: us-east-1
>        device_name: /dev/xvdb
>
> With that in mind I can see the ec2_facts of the tagged instances that I'm 
> going to use in the cluster but when executed it doesn't recognized the 
> ansible_ec2_instance_id variable that I can actually see when running the 
> ec2_facts.
>
> Any idea why?
>
>
> Thank you.
>

-- 
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/dca351f4-414a-4037-b661-e456f12dcb68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to