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

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:

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

Any suggestions?

Eric Feldhusen

Maybe loop across a list of the keys? Suggestion from deep ignorance…

@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:
          - https://github.com/username1.keys
          - https://github.com/username2.keys
          - https://github.com/username3.keys

My apologies, I will do that next time.

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

Eric Feldhusen