Skip to the content.

Add Authorized SSH Key to User using Ansible

Some examples of Ansible Playbooks for adding/updating authorized keys for SSH login.

1. Set Authorized Key(s) from URL

- name: Set Authorized Key(s) from an URL
  ansible.posix.authorized_key:
    user: charlie
    state: present
    key: https://github.com/crazyuploader.keys

Reference: Add or Remove SSH Authorized Key - Ansible Documentation