Skip to content

Instantly share code, notes, and snippets.

@jeanlouisferey
Created March 22, 2018 16:01
Show Gist options
  • Save jeanlouisferey/286a0f10bf7f92e519f851d7523d69d9 to your computer and use it in GitHub Desktop.
Save jeanlouisferey/286a0f10bf7f92e519f851d7523d69d9 to your computer and use it in GitHub Desktop.
---
- name: Add ssh public key locally
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: List ssh public keys
find:
path: ./public-keys
pattern: "*-pubkey"
register: files_matched
- name: test
debug:
msg: "{{ item.path }}"
verbosity: 3
with_items: "{{ files_matched.files }}"
- name: Set up multiple authorized keys
authorized_key:
user: cloud
state: present
key: '{{ item }}'
with_file: "{{ files_matched.files | list | map(attribute='path') | list }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment