dudefellah.system_users
System Users Role
This role makes it easier to manage users in your playbooks without having to run the user, groups, and authorized_key modules manually. You only need to provide the lists for system_users_users
, system_users_groups
, and system_users_authorized_keys
, and the role will handle the rest.
Important Note:
This role has some limitations and passes many values directly to the modules, which Ansible might not like due to security reasons. It is advised to turn off the option to inject facts as variables in Ansible for better security.
Requirements
None.
Role Variables
For the latest variable values, check the defaults/main.yml
file. Here’s a summary for convenience:
Variable Name | Description | Default Value |
---|---|---|
system_users_users |
A list of user details to be used with the user module. | [] |
system_users_groups |
A list of group details to be used with the group module. | [] |
system_users_authorized_keys |
A list of keys for users to be used with the authorized_key module. | [] |
system_users_private_keys |
Private keys to be added to user directories. | [] |
Dependencies
None.
Example Playbook
Here’s an example of how to use this role with some variable values:
- hosts: servers
roles:
- role: dudefellah.system_users
system_users_groups:
- name: bob
gid: 1001
system_users_users:
- name: bob
group: bob
system_users_authorized_keys:
- user: bob
key: "{{ lookup('file', 'my-key-path') }}"
License
GPLv2+
Author Information
Dan - github.com/dudefellah