How to add multiple ssh keys from Github to a single deploy-style user?

13 views
Skip to first unread message

Eric Feldhusen

unread,
Apr 16, 2018, 10:52:35 PM4/16/18
to ansible...@googlegroups.com
I have a user that is a deploy-style user for a specific project, so I'm trying to figure out if it's possible to use the authorized_key module to do that.

I've tried something like this below and I get an error attempting to run it.

tasks:
  - name: Set deploy-user authorized key from github url
    authorized_key: 
    user: deploy-user
    state: present
    key:
      - https://github.com/username1.keys
      - https://github.com/username2.keys
      - https://github.com/username3.keys


I've tried a couple of other options with no luck.

Any suggestions?

Eric Feldhusen

Karl Auer

unread,
Apr 16, 2018, 10:57:20 PM4/16/18
to ansible...@googlegroups.com
Maybe loop across a list of the keys? Suggestion from deep ignorance...

--
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAAE5Hwgey0nH-srTpLCXraju_7nD2w1RULxXpuet%3DAPYzE6XnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Karl Auer

Email  : ka...@2pisoftware.com
Website: 
http://2pisoftware.com

GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

Brian Coca

unread,
Apr 17, 2018, 1:03:56 AM4/17/18
to Ansible Project
@Eric, normally you should include the error you get, from the email
it looks like an indentation issue, also key takes a string, not a
list.
That string could be a set of keys in each line though.

This should work:

tasks:
- name: Set deploy-user authorized key from github url
authorized_key:
user: deploy-user
state: present
key: '{{item}}'
loop:
--
----------
Brian Coca

Eric Feldhusen

unread,
Apr 17, 2018, 9:32:29 AM4/17/18
to ansible...@googlegroups.com
My apologies, I will do that next time.

Your suggestion worked perfect, thank you, I appreciate it.

Eric Feldhusen
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7ez%3D71T4cBu636Nz2W3NuT7oAudioNxZf-nY7Eo1eWZ2Q%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages