An Ansible to manage SSH authorized_keys files.
None.
# list of authorized keys specifications
authorized_keys__list: []
## authorized key
# - key: string
## user of authorized key
# user: string
## OPTIONAL: should be authorized key exclusive
# exclusive: boolean
## OPTIONAL: ssh key options
# key_options: string
## OPTIONAL: should directory containing authorized_keys file be managed by ansible
# manage_dir: boolean
## OPTIONAL: path for authorized_keys file
# path: string
## OPTIONAL: if set to true, authorized key is removed
# disabled: boolean
# default value for exclusive option of authrozied keys
authorized_keys__default_exclusive: false
# default value for manage_dir option of authorized keys
authorized_keys__default_manage_dir: true
None.
- hosts: all
roles:
- role: "tomashavlas.authorized_keys"
authorized_keys__list:
- key: "{{ lookup('file', 'files/public_keys/root/id_rsa.pub') }}"
user: "root"
exclusive: true
- key: |
{{ lookup('file', 'files/public_keys/example/id_rsa.pub') }}
{{ lookup('file', 'files/public_keys/example/id_ed25519.pub') }}
user: "example"
For more examples see test cases.
BSD
Created by Tomáš Havlas in 2016.