Yes, you can use lookups, like this
- name: set authorized_keys
authorized_key: user={{ item }} exclusive=yes
key="{{ lookup('file', 'files/pubkeys/{{ item }}.key') }}"
with_items: "{{ team_members[team] }}"
team_members[team] here is a list of usernames,
the files live in rolename/files/pubkeys/$username.key
original role is here :
https://github.com/rasputnik/ansible-sshteams/blob/master/roles/teams/tasks/team.yml
On 4 July 2017 at 08:32, Suporter <[email protected]> wrote:
> Is there a way to store all accounts keys as some files and call them as
> extra vars in playbook?
>
> On Monday, July 3, 2017 at 2:28:29 PM UTC+5:30, Darragh Grealish wrote:
>>
>> Yes, you pass them as extra-vars, but there are many ways to do this, just
>> watch out where you run your playbook and if AWS ENV variables are already
>> set, as boto will take this into account also.
>> best to understand better the AWS credentials and profiles
>>
>> http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html#credentials-default
>>
>> On Monday, 3 July 2017 07:28:33 UTC+2, Suporter wrote:
>>>
>>> Any help?
>>>
>>> On Thursday, June 29, 2017 at 11:28:59 AM UTC+5:30, Suporter wrote:
>>>>
>>>> Hi Ansiblers,
>>>> How can i use same playbook for multiple aws accounts, can i give
>>>> the access key and secret key as command line paramters in playbook?
>
> --
> 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/5edfad13-4420-4826-a70e-5bfbd56cec86%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/CAK5eLPRd8PquR21OnsMO-nMLg_9HKW%3DrRr2wN4OKZ_n47JhJVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.