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

Create variable for additional groups

Addoption to create groups

CLOSE https://github.com/roles-ansible/ansible_collection_users/issues/26
This commit is contained in:
L3D 2024-08-08 16:39:28 +02:00
parent ecf4485eda
commit f1eb517563
Signed by: l3d
GPG key ID: CD08445BFF4313D1
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_command`` | ``ALL`` | Commans with superpower for ansible user |
| ``l3d_users__ansible_user_nopassword`` | ``true`` | Allow superpowers without password 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__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_port`` | ``22`` | Port for SSH |
| ``l3d_users__sshd_password_authentication`` | ``false`` | Allow login with Password | | ``l3d_users__sshd_password_authentication`` | ``false`` | Allow login with Password |
| ``l3d_users__sshd_permitrootlogin`` | ``false`` | Allow login as root | | ``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__set_root_ssh_keys`` | ``false`` | Set SSH Keys for root User |
| ``l3d_users__root_ssh_keys`` | | Additional 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 | | ``submodules_versioncheck`` | ``false`` | Optionaly enable simple versionscheck of this role |
| ``l3d_users__additional_groups`` | ``[]`` | Optionally create some groups |
Example Playbook 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__ansible_user_password: ''
l3d_users__set_root_ssh_keys: false l3d_users__set_root_ssh_keys: false
l3d_users__root_ssh_keys: '' l3d_users__root_ssh_keys: ''
l3d_users__additional_groups: []
# run simple versionscheck # run simple versionscheck
submodules_versioncheck: false submodules_versioncheck: false

View file

@ -10,6 +10,13 @@
loop_var: user loop_var: user
when: user.state | default ('present') == 'present' 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 - name: Create Accounts for Users
become: true become: true
ansible.builtin.user: ansible.builtin.user:

View file

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