An Ansible role to provision a Linux user without privileges, including distributing authorized keys to it.
N/A
You need to define the following variable:
app_user: The name of your user which should be created by this role.authorized_keys: A JSON list of public SSH keys which can login as this user.
authorized_keys should be defined in group variables. It's a JSON object where the key is "{{ app_user }}" and the value is an array of SSH keys. It would look like this:
authorized_keys:
{
"{{ app_user }}": [
"key1",
"key2",
"key3"
]
}If you need to add additional keys, e.g. because for one system, a customer of yours has access, you can provide additional_authorized_keys. It follows the same format as authorized_keys.
additional_authorized_keys:
{
"{{ app_user }}": [
"key1",
"key2",
"key3"
]
}None.
- hosts: myserver
roles:
- { role: simplificator.app_user }
vars:
authorized_keys:
{
"{{ app_user }}": [
"key1",
"key2",
"key3"
]
}MIT / BSD