Hi,

Not sure I follow, I understand that {{ item }} comes from with_file. The 
same as other loops

Maybe i'm missing something and I apologise 

All I want to achieve is to conditionally handle the key if the path to a 
key is specified. 

I also don't want it to log the key if its skipped and I want it to skip if 
the path isn't specified.

The docs don't mention using lookup

# Creates a new ec2 key pair named `example` if not present using provided key
# material
- name: example3 ec2 key
  local_action:
    module: ec2_key
    name: example3
    key_material: "{{ item }}"
  with_file: /path/to/public_key.id_rsa.pub


Also just found that if the key changes the documentation claims that the 
key is returned. I just get the following message returned

TASK: [openbet/aws/ec2-security | Create ec2 key pair] 
************************ 
changed: [localhost]


TASK: [openbet/aws/ec2-security | copy content={{ ec2_key }} 
dest="~/{{ec2_key_name}}.pem"] *** 
ok: [localhost -> 127.0.0.1]

TASK: [openbet/aws/ec2-security | debug msg={{ ec2_key }}] 
******************** 
*ok: [localhost] => {*
*    "msg": "{'invocation':"*
*}*



On Saturday, 17 January 2015 17:30:26 UTC, Dan Vaida wrote:
>
> If you read the documentation page of this module careful enough, you will 
> see that, in fact, the “{{ item }}” comes from the with_file, not from your 
> vars. That is the material :) 
>
> On Jan 17, 2015, at 6:13 PM, James Morgan <[email protected] 
> <javascript:>> wrote: 
>
> > Hi, 
> > 
> > That gives me the following 
> > 
> > TASK: [openbet/aws/ec2-create-instance | Create ec2 key pair using local 
> key] *** 
> > fatal: [localhost] => could not locate file in lookup: -----BEGIN RSA 
> PRIVATE KEY----- 
> > 
> MIIEogIBAAKCAQEAkYI6Fxq0Qlxmn0rwWlyVX4VERtahcjZDFMA8VnJiPCcHMcGSZWmqkVusrm39 
>
> > 
> wIHi16uUwyj+D0BpoNEDy8mvaRvE9apwn2s/Ampyb8nQnHCNdx43wu+AIN3PG8PAfRbrcGlPpKpQ 
>
> > 
> > The location is correct. 
> > 
> > I'm running ansible-playbook 1.8.2 
> > 
> > 
> > It still logs the private key which is iffy and   
> > 
> > when: ec2_key_material is defined 
> > 
> > isn't stopping it from looking for the file. I would have thought it 
> would have short circuited itself before doing any lookups 
> > 
> > James 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to a topic in the 
> Google Groups "Ansible Project" group. 
> > To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/S-_Fe4V0Ebo/unsubscribe. 
>
> > To unsubscribe from this group and all its topics, send an email to 
> [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/fe6d92ef-1948-4112-a5ef-e53c286f1424%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
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/786d02aa-5942-48a3-9971-6c3e041da7a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to