Aha - one more piece.
It works fine as a task but not as a post_task in a playbook.
This playbook fails:
- hosts: servers
post_tasks:
- name: Set the authorized key everywhere
authorized_key: user=someuser key="{{lookup('file', item)}}"
with_fileglob:
- /tmp/keys/*
This one succeeds:
- hosts: servers
tasks:
- name: Set the authorized key everywhere
authorized_key: user=someuser key="{{lookup('file', item)}}"
with_fileglob:
- /tmp/keys/*
On Tuesday, January 6, 2015 at 2:08:29 PM UTC-5, Solomon Gifford wrote:
>
> Matthieu,
>
> I was able to use the pipe lookup to get around this:
>
> - authorized_key: user=bob key='{{lookup("pipe",
> "cat /some/absolute/path/id_*.pub" )}}'
>
> On Tuesday, December 9, 2014 11:32:23 AM UTC-5, Mathieu Guillaume wrote:
>>
>> Looks like some kind of parsing issue, if I use the full YAML syntax
>> below it works, but not if I use key=...
>>
>> Working:
>>
>> - authorized_key:
>> user: bob
>> key: "{{lookup('file',item)}}"
>> with_fileglob:
>> - /some/absolute/path/id_*.pub
>>
>> Not working:
>>
>> - authorized_key: user=bob key='{{lookup("file", item)}}'
>> with_fileglob:
>> - /some/absolute/path/id_*.pub
>>
>>
>> On Tuesday, December 9, 2014 5:04:00 PM UTC+1, Brian Coca wrote:
>>>
>>> I did very simple (if contrived) test and this seems to work fine:
>>>
>>>
>>> - copy: content={{lookup('file',item)}} dest=/tmp/{{item|basename}}
>>> with_fileglob:
>>> - files/*
>>>
>>>
>>> --
>>> Brian Coca
>>>
>>
--
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/890cb977-04be-4254-8592-89abd698ea46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.