Skip to content

Instantly share code, notes, and snippets.

@aruhier
Created February 2, 2017 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aruhier/560531b33f2e8123f97d6f7def214d1d to your computer and use it in GitHub Desktop.
Save aruhier/560531b33f2e8123f97d6f7def214d1d to your computer and use it in GitHub Desktop.
Ansible handle ssk keys
- name: ssh - add authorized keys {{ playbook_dir }}
authorized_key: "
user='{{ ansible_env.USER }}'
key='{{ lookup('file', playbook_dir + '/files/ssh_public_keys/' + item) }}'
state=present
"
with_items: "{{ ssh_authorized_keys }}"
- name: ssh - add authorized keys {{ playbook_dir }}
authorized_key: "
user='{{ ansible_env.USER }}'
key='{{ lookup('file', playbook_dir + '/files/ssh_public_keys/' + item) }}'
state=absent
"
with_items: "{{ ssh_revoke_authorized_keys }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment