Hi Matt,

I'm aware of the syntax issues; I quickly wrote those two lines from the 
back of my head without verifying their syntax; sloppy really.
What I didn't know though was the way you concatenated the strings; should 
have known though, it's python after all.

Anyway, thanks the provided solution helped me to implement what I wanted.

On Thursday, October 2, 2014 3:58:01 PM UTC+2, Matt Martz wrote:
>
> I am not sure what list_of_my_users_obtained_earlier looks like, but 
> assuming it is just a normal list of just usernames, you probably want 
> something like:
>
> authorized_key: user="{{ item }}" key="{{ lookup('file', 'public-keys/' + 
> item + '.pub') }}"
> with_items: list_of_my_users_obtained_earlier
>
> I noticed several syntax issues.  Such as using {{ }} inside of other {{ 
> }}, which is not needed or allowed.  Missing quotes around your path in 
> the lookup.  A missing space between '-' and 
> 'list_of_my_users_obtained_earlier', which is not actually needed, you can 
> just give the list on the same line was with_items.  You were using 'item' 
> in one place, but 'item.1' in another.
>
> On Thu, Oct 2, 2014 at 8:52 AM, Nico K. <[email protected] <javascript:>> 
> wrote:
>
>> Hi,
>>
>> In my setup, I have a master host that contains all accounts, these 
>> accounts are to be kept in sync across a bunch of isolated remote 
>> environments.
>> The account creation/deletion is not a problem, however I can't seem to 
>> find out a way to deploy the ssh key for each user without having to write 
>> a separate statement for each account.
>>
>> What I'd like to do is:
>>
>> authorized_key: user={{ item }} key={{ lookup('file', public-keys/{{ 
>> item.1 }}.pub) }}
>> with_items:
>>   -list_of_my_users_obtained_earlier
>>
>> Sadly this doesn't work (can't figure out why it doesn't either, no error 
>> is given).
>> Is there another way of doing this?
>>
>> Thanks,
>> Nico
>>
>> -- 
>> 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] <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/998aacd7-01c5-4533-a330-02ccf75e21c7%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/998aacd7-01c5-4533-a330-02ccf75e21c7%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>  

-- 
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/e61eea7f-d240-4fb7-87d6-4f82b37e2cf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to