Skip to content

havlasme/ansible-role-authorized_keys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

authorized_keys

Ansible Galaxy Build Status Latest Tag

An Ansible to manage SSH authorized_keys files.

Requirements

None.

Role Variables

# 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

Dependencies

None.

Example Playbook

- 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.

License

BSD

Author Information

Created by Tomáš Havlas in 2016.