-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(local-system-user): add local system user role (#45)
* feat(local-system-uer): add local system user role * feat(local-system-user): Readme update and shell /sbin/nologin added
- Loading branch information
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Ansible Role - radiorabe.common.local-system-user | ||
|
||
Manage local system users using [`ansible.builtin.user module`](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html). Shell or password won't be set with this role. | ||
|
||
## Requirements | ||
|
||
None | ||
|
||
## Role Variables | ||
|
||
| Variable | Default | Description | | ||
| -------- | ------- | ----------- | | ||
| `username` | `not set` | Name of the user. **required** | | ||
| `home_directory` | `/home/{{username}}` | Home directory of the user. | | ||
| `usergroups` | `''` | Existing groups the user should be added to. | | ||
|
||
## Dependencies | ||
|
||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. | ||
|
||
## Example Playbook | ||
|
||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: | ||
|
||
```yaml | ||
- hosts: all | ||
roles: | ||
- role: radiorabe.common.local-system-user | ||
vars: | ||
username: local-sys | ||
- role: radiorabe.common.local-system-user | ||
vars: | ||
username: virtualizer | ||
home_directory: /var/lib/libvvirt/images/ | ||
usergroups: 'libvirt,qemu' | ||
``` | ||
## License | ||
This role is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# defaults for radiorabe.common.local-system-user | ||
|
||
home_directory: '/home/{{username}}' | ||
usergroups: '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
galaxy_info: | ||
author: RaBe IT-Reaktion | ||
description: Allow managing of local system users. | ||
issue_tracker_url: https://github.com/radiorabe/ansible-collection-common/issues | ||
license: AGPL-3.0-only | ||
min_ansible_version: '2.9' | ||
platforms: | ||
- name: EL | ||
versions: | ||
- all | ||
- name: Fedora | ||
version: | ||
- all | ||
galaxy_tags: | ||
- radiorabe | ||
- foreman | ||
- common | ||
- system | ||
- groups | ||
- users | ||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
# tasks file for radiorabe.common.local-system-user | ||
|
||
- name: 'RaBe Base : Local System User : Add user {{ username }} with groups {{ usergroups }} and user home {{ home_directory }}.' | ||
ansible.builtin.user: | ||
name: '{{ username }}' | ||
home: '{{ home_directory }}' | ||
groups: '{{ usergroups }}' | ||
shell: '/sbin/nologin' | ||
system: true | ||
append: yes |