authorized_key

Collection: posix

Full Name: parallax.posix.authorized_key

Aliases: ansible.posix.authorized_key, authorized_key

Synopsis

Manage the SSH keys authorised for a user

Parameters

NameTypeRequiredDefaultDescription
userstringyesThe username on the remote host whose authorized_keys file will be modified
keystringyesThe SSH public key(s), as a string or url (https://github.com/username.keys)
pathstringAlternate path to the authorized_keys file (default: ~user/.ssh/authorized_keys)
statestringpresentWhether the given key should be in the file or not Choices: present, absent
exclusiveboolfalseWhether to remove all other non-specified keys from the authorized_keys file
manage_dirbooltrueWhether this module should manage the directory of the authorized_keys file
key_optionsstringA string of ssh key options to be prepended to the key in the authorized_keys file
commentstringChange the comment on the public key (only supported for keys in the file, not for URLs)
validate_certsbooltrueThis only applies if using a https url as the source of the keys
followboolfalseFollow path symlink instead of replacing it

Example

- name: Authorise the deploy key
  authorized_key:
    user: deploy
    key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExampleKeyMaterialHere deploy@ci"
    state: present