1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_collection_users.git synced 2024-08-16 10:29:50 +02:00

Merge pull request #2 from roles-ansible/101

add ability to add additional groups
This commit is contained in:
L3D 2024-02-23 19:18:35 +01:00 committed by GitHub
commit c9da584816
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 39 additions and 2 deletions

View file

@ -16,6 +16,37 @@ And it is possible to delete users too.
+ ``l3d.users.admin``: [roles/admin](roles/admin) ![logo](https://ansible.l3d.space/svg/l3d.users.admin_ansible-role.svg) + ``l3d.users.admin``: [roles/admin](roles/admin) ![logo](https://ansible.l3d.space/svg/l3d.users.admin_ansible-role.svg)
+ ``l3d.users.sshd``: [roles/sshd](roles/admin) ![logo](https://ansible.l3d.space/svg/l3d.users.sshd_ansible-role.svg) + ``l3d.users.sshd``: [roles/sshd](roles/admin) ![logo](https://ansible.l3d.space/svg/l3d.users.sshd_ansible-role.svg)
## Using this Collection
You can install the collection using ansible-galaxy by running:
```bash
ansible-galaxy collection install l3d.users:1.0.1
```
Remember you can to Upgrade to the latest version of the l3d.git collection using the ``--upgrade`` parameter:
```bash
ansible-galaxy collection install l3d.users --upgrade
```
Or you could clone this collection in your local ansible project for example to ``collections/ansible_collections/l3d/users/``.
```
# Clone git Repo to specified path
git clone https://github.com/roles-ansible/ansible_collection_users.git collections/ansible_collections/l3d/users/
# change directory
cd collections/ansible_collections/l3d/users/
# optionally install all requirements
ansible-galaxy collection install -r requirements.yml --upgrade
```
You can also list a collection in ``requirements.yml``:
```yaml
---
collections:
- name: l3d.users
version: ">=1.0.1"
```
Global Variables: Global Variables:
------------------- -------------------
@ -38,6 +69,7 @@ The Option of these directory-variables are the following.
| ``pubkeys`` | string or lookup | - | see examples | | ``pubkeys`` | string or lookup | - | see examples |
| ``exklusive_pubkeys`` | ``true`` | - | delete all undefined ssh keys | | ``exklusive_pubkeys`` | ``true`` | - | delete all undefined ssh keys |
| ``password`` | password hash | - | See [official FAQ](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module) | | ``password`` | password hash | - | See [official FAQ](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module) |
| ``groups`` | list | - | Additional groups for your user |
| ``remove`` | ``false`` | - | completly remove user if ``state: absent`` | | ``remove`` | ``false`` | - | completly remove user if ``state: absent`` |
### Other variables ### Other variables

View file

@ -9,7 +9,7 @@ namespace: l3d
name: users name: users
# The version of the collection. Must be compatible with semantic versioning # The version of the collection. Must be compatible with semantic versioning
version: 1.0.0 version: 1.0.1
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection # The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md readme: README.md

View file

@ -29,6 +29,7 @@ The Option of these directory-variables are the following.
| ``pubkeys`` | string or lookup | - | see examples | | ``pubkeys`` | string or lookup | - | see examples |
| ``exklusive_pubkeys`` | ``true`` | - | delete all undefined ssh keys | | ``exklusive_pubkeys`` | ``true`` | - | delete all undefined ssh keys |
| ``password`` | password hash | - | See [official FAQ](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module) | | ``password`` | password hash | - | See [official FAQ](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module) |
| ``groups`` | list | - | Additional groups for your user |
| ``remove`` | ``false`` | - | completly remove user if ``state: absent`` | | ``remove`` | ``false`` | - | completly remove user if ``state: absent`` |
### Other ### Other

View file

@ -27,6 +27,7 @@ The Option of these directory-variables are the following.
| ``pubkeys`` | string or lookup | - | see examples | | ``pubkeys`` | string or lookup | - | see examples |
| ``exklusive_pubkeys`` | ``true`` | - | delete all undefined ssh keys | | ``exklusive_pubkeys`` | ``true`` | - | delete all undefined ssh keys |
| ``password`` | password hash | - | See [official FAQ](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module) | | ``password`` | password hash | - | See [official FAQ](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module) |
| ``groups`` | list | - | Additional groups for your user |
| ``remove`` | ``false`` | - | completly remove user if ``state: absent`` | | ``remove`` | ``false`` | - | completly remove user if ``state: absent`` |
There is a third directory-variable called ``l3d_users__ssh_login: []`` which only support ``name`` and ``state`` for users, that sould be able to login on that system. There is a third directory-variable called ``l3d_users__ssh_login: []`` which only support ``name`` and ``state`` for users, that sould be able to login on that system.

View file

@ -28,6 +28,7 @@ The Option of these directory-variables are the following.
| ``pubkeys`` | string or lookup | - | see examples | | ``pubkeys`` | string or lookup | - | see examples |
| ``exklusive_pubkeys`` | ``true`` | - | delete all undefined ssh keys | | ``exklusive_pubkeys`` | ``true`` | - | delete all undefined ssh keys |
| ``password`` | password hash | - | See [official FAQ](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module) | | ``password`` | password hash | - | See [official FAQ](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module) |
| ``groups`` | list | - | Additional groups for your user |
| ``remove`` | ``false`` | - | completly remove user if ``state: absent`` | | ``remove`` | ``false`` | - | completly remove user if ``state: absent`` |
### Other Variables ### Other Variables

View file

@ -15,6 +15,7 @@ l3d_users__default_users: []
# admin_commands: 'ALL' # admin_commands: 'ALL'
# admin_nopassword: false # admin_nopassword: false
# admin_ansible_login: true # admin_ansible_login: true
# groups: ['admin', 'foo', 'bar']
# - name: 'bob' # - name: 'bob'
# state: 'present' # state: 'present'
# shell: '/bin/zsh' # shell: '/bin/zsh'

View file

@ -15,6 +15,7 @@
ansible.builtin.user: ansible.builtin.user:
name: "{{ user.name }}" name: "{{ user.name }}"
group: "{{ user.name }}" group: "{{ user.name }}"
groups: "{{ user.groups | default() }}"
state: 'present' state: 'present'
create_home: "{{ user.create_home | default(true) }}" create_home: "{{ user.create_home | default(true) }}"
comment: "User created by ansible" comment: "User created by ansible"

View file

@ -1,3 +1,3 @@
--- ---
playbook_version_number: 8 playbook_version_number: 9
playbook_version_path: 'l3d.users.user.version' playbook_version_path: 'l3d.users.user.version'