Try with_file: "{{ lookup('file', 'path/goes/here' ) }}"
On Saturday, 17 January 2015 17:04:47 UTC+1, James Morgan wrote:
>
> Hi,
>
> I have the following task
>
> - name: Create ec2 key pair using local key
> when: ec2_key_material is defined
> ec2_key:
> name: "{{ ec2_key_name }}"
> region: "{{ ec2_region }}"
> key_material: "{{ item }}"
> with_file: /path/to/public_key.id_rsa.pub
>
> Code was taking from http://docs.ansible.com/ec2_key_module.html
>
> ec2_key_material is not defined
>
> Whilst it does skip it tries to find the file. If I wanted to pass the
> file into the role and do the following
>
> with_file: "{{ ec2_key_material }}"
>
>
> I get
>
> TASK: [openbet/aws/ec2-create-instance | Create ec2 key pair using local
> key] ***
> fatal: [localhost] => could not locate file in lookup: {{
> ec2_key_material }}
>
>
> If I add a real path then it logs out the key. I really don't want that
> happening
>
> TASK: [openbet/aws/ec2-create-instance | Create ec2 key pair using local
> key] ***
> skipping: [localhost] => (item=-----BEGIN RSA PRIVATE KEY-----
>
> MIIEogIBAAKCAQEAkYI6Fxq0Qlxmn0rwWlyVX4VERtahcjZDFMA8VnJiPCcHMcGSZWmqkVusrm39
> .....
> 9B5yU8q4D9vEzuLYmbaRJji9YpTnPCHEHJ7Dn9a85UMIk+
> D0AYsHDMW3rqkovcsXhwft5CdIVDJ0
> gNgSLOyND24AHxTwxBhHnAf3oSsoYpx5PgcT75ydE123nGFWa4siMZiV/vP4+ycOUF4=
> -----END RSA PRIVATE KEY-----)
>
>
> Any suggestions. The latter issue seems worrying
>
> Thanks
>
> James
>
--
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/8108e951-0ba1-4220-9014-c6934019c229%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.