Hi Joanna,

Thanks for your post, I just tried your suggestion but still isn't 
working.  But you pointed me in the right direction.  I was running 
ec2_facts as a local action which was incorrect and using a tripple debug 
flag I noticed that aws_access_key and aws_secret_key were null, seems kind 
of dump having to set them up as variables for ec2_vol to work, but after 
doing that but it worked, bellow how I end up doing it

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



On Thursday, July 21, 2016 at 1:23:36 PM UTC-6, Joanna Delaporte wrote:
>
> 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/e02a97ef-c70b-4e59-9382-6c61e75b7cc0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to