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 #31 from roles-ansible/g

Create variable for additional groups
This commit is contained in:
L3D 2024-08-08 16:41:47 +02:00 committed by GitHub
commit 852a5e1ad1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 1 deletions

View file

@ -92,6 +92,7 @@ There is also the ``l3d_users__ssh_login`` variable which only supports ``name``
| ``l3d_users__ansible_user_command`` | ``ALL`` | Commans with superpower for ansible user |
| ``l3d_users__ansible_user_nopassword`` | ``true`` | Allow superpowers without password for ansible user |
| ``l3d_users__limit_login`` | ``true`` | Only allow SSH login for specified users |
| ``l3d_users__additional_groups`` | ``[]`` | Optionally create some groups |
| ``l3d_users__sshd_port`` | ``22`` | Port for SSH |
| ``l3d_users__sshd_password_authentication`` | ``false`` | Allow login with Password |
| ``l3d_users__sshd_permitrootlogin`` | ``false`` | Allow login as root |

View file

@ -46,6 +46,7 @@ The Option of these directory-variables are the following.
| ``l3d_users__set_root_ssh_keys`` | ``false`` | Set SSH Keys for root User |
| ``l3d_users__root_ssh_keys`` | | Additional SSH Keys for root User |
| ``submodules_versioncheck`` | ``false`` | Optionaly enable simple versionscheck of this role |
| ``l3d_users__additional_groups`` | ``[]`` | Optionally create some groups |
Example Playbook
-----------------

View file

@ -37,6 +37,7 @@ l3d_users__ansible_ssh_keys: "{{ lookup('url', 'https://github.com/do1jlr.keys',
l3d_users__ansible_user_password: ''
l3d_users__set_root_ssh_keys: false
l3d_users__root_ssh_keys: ''
l3d_users__additional_groups: []
# run simple versionscheck
submodules_versioncheck: false

View file

@ -10,6 +10,13 @@
loop_var: user
when: user.state | default ('present') == 'present'
- name: Optionally create additional Groups
become: true
ansible.builtin.group:
name: "{{ item }}"
state: 'present'
with_items: "{{ l3d_users__additional_groups }}"
- name: Create Accounts for Users
become: true
ansible.builtin.user:

View file

@ -1,3 +1,3 @@
---
playbook_version_number: 16
playbook_version_number: 17
playbook_version_path: 'l3d.users.user.version'