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

update metadata to roles

This commit is contained in:
L3D 2024-02-18 15:44:57 +01:00
parent 22551c7eb9
commit 47bc6d9718
No known key found for this signature in database
GPG key ID: AD65B920933B4B20
10 changed files with 123 additions and 37 deletions

View file

@ -1,7 +1,7 @@
Ansible Role Admin Ansible Role Admin
==================== ====================
Ansible role l3d.users.admin Manage Admin-Permissions of Users. Ansible role l3d.users.admin to manage Admin-Permissions of Users.
# WORK IN PROGRESS # WORK IN PROGRESS

25
roles/admin/meta/main.yml Normal file
View file

@ -0,0 +1,25 @@
---
galaxy_info:
role_name: admin
author: l3d
description: Ansible role l3d.users.admin to manage Admin-Permissions of Users.
license: "MIT"
min_ansible_version: "2.16"
platforms:
- name: Debian
versions: ['all']
- name: Ubuntu
versions:
versions: ['all']
- name: Fedora
versions:
versions: ['all']
- name: EL
versions:
versions: ['all']
galaxy_tags:
- admin
- users
- setup
- linux
dependencies: []

View file

@ -2,23 +2,25 @@
- name: Give admins superpower - name: Give admins superpower
become: true become: true
community.general.sudoers: community.general.sudoers:
name: "{{ item.name }}-superpowers" name: "{{ user.name }}-superpowers"
user: "{{ item.name }}" user: "{{ user.name }}"
state: 'present' state: 'present'
commands: "{{ item.admin_commands | default('ALL') }}" commands: "{{ user.admin_commands | default('ALL') }}"
nopassword: "{{ item.admin_nopassword | default(false) }}" nopassword: "{{ user.admin_nopassword | default(false) }}"
loop: "{{ _l3d_users__merged_users }}" loop: "{{ _l3d_users__merged_users }}"
loop_control: loop_control:
label: "user: ['{{ item.name }}']" label: "user={{ user.name }}"
when: item.state | default ('present') == 'present' and item.admin | default(false) | bool loop_var: user
when: user.state | default ('present') == 'present' and user.admin | default(false) | bool
- name: Remove superpowers from Users - name: Remove superpowers from Users
become: true become: true
community.general.sudoers: community.general.sudoers:
name: "{{ item.name }}-superpowers" name: "{{ user.name }}-superpowers"
state: 'absent' state: 'absent'
user: "{{ item.name }}" user: "{{ user.name }}"
loop: "{{ _l3d_users__merged_users }}" loop: "{{ _l3d_users__merged_users }}"
loop_control: loop_control:
label: "user: ['{{ item.name }}']" label: "user={{ user.name }}"
when: item.state | default ('present') == 'present' and not item.admin | default(false) | bool loop_var: user
when: user.state | default ('present') == 'present' and not user.admin | default(false) | bool

26
roles/sshd/meta/main.yml Normal file
View file

@ -0,0 +1,26 @@
---
galaxy_info:
role_name: sshd
author: l3d
description: Ansible role l3d.users.sshd to Manage SSHD Configuration of the system and which Accounts are allowed to login
license: "MIT"
min_ansible_version: "2.16"
platforms:
- name: Debian
versions: ['all']
- name: Ubuntu
versions:
versions: ['all']
- name: Fedora
versions:
versions: ['all']
- name: EL
versions:
versions: ['all']
galaxy_tags:
- sshd
- ssh
- users
- setup
- linux
dependencies: []

View file

@ -1,5 +1,5 @@
--- ---
playbook_version_number: 3 playbook_version_number: 4
playbook_version_path: 'l3d.users.sshd.version' playbook_version_path: 'l3d.users.sshd.version'
l3d_users_sshd__service_var_path: l3d_users_sshd__service_var_path:

27
roles/user/meta/main.yml Normal file
View file

@ -0,0 +1,27 @@
---
galaxy_info:
role_name: user
author: l3d
description: Ansible role l3d.users.user to create Users with their group and their SSH Public Keys to their account.
license: "MIT"
min_ansible_version: "2.16"
platforms:
- name: Debian
versions: ['all']
- name: Ubuntu
versions:
versions: ['all']
- name: Fedora
versions:
versions: ['all']
- name: EL
versions:
versions: ['all']
galaxy_tags:
- user
- ssh
- pubkeys
- users
- setup
- linux
dependencies: []

View file

@ -2,11 +2,12 @@
- name: Set SSH Public Keys for Users - name: Set SSH Public Keys for Users
become: true become: true
ansible.posix.authorized_key: ansible.posix.authorized_key:
user: "{{ item.name }}" user: "{{ user.name }}"
state: 'present' state: 'present'
key: "{{ item.pubkeys | default() }}" key: "{{ user.pubkeys | default() }}"
exclusive: true exclusive: true
loop: "{{ _l3d_users__merged_users }}" loop: "{{ _l3d_users__merged_users }}"
loop_control: loop_control:
label: "user: ['{{ item.name }}']" label: "user={{ user.name }}"
when: item.state | default ('present') == 'present' loop_var: user
when: user.state | default ('present') == 'present'

View file

@ -30,8 +30,9 @@
ansible.posix.authorized_key: ansible.posix.authorized_key:
user: 'ansible' user: 'ansible'
state: "{{ l3d_users__ansible_user_state | ternary('present', 'absent') }}" state: "{{ l3d_users__ansible_user_state | ternary('present', 'absent') }}"
key: "{{ item.pubkeys | default() }}" key: "{{ user.pubkeys | default() }}"
loop: "{{ _l3d_users__merged_users }}" loop: "{{ _l3d_users__merged_users }}"
when: item.admin | default(false) | bool and item.admin_ansible_login | default(true) | bool when: user.admin | default(false) | bool and user.admin_ansible_login | default(true) | bool
loop_control: loop_control:
label: "user: ['{{ item.name }}']" label: "user={{ user.name }}"
loop_var: user

View file

@ -2,45 +2,49 @@
- name: Create Groups for Users - name: Create Groups for Users
become: true become: true
ansible.builtin.group: ansible.builtin.group:
name: "{{ item.name }}" name: "{{ user.name }}"
state: 'present' state: 'present'
loop: "{{ _l3d_users__merged_users }}" loop: "{{ _l3d_users__merged_users }}"
loop_control: loop_control:
label: "user: ['{{ item.name }}']" label: "user={{ user.name }}"
when: item.state | default ('present') == 'present' loop_var: user
when: user.state | default ('present') == 'present'
- name: Create Accounts for Users - name: Create Accounts for Users
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: "{{ item.name }}" name: "{{ user.name }}"
group: "{{ item.name }}" group: "{{ user.name }}"
state: 'present' state: 'present'
create_home: "{{ item.create_home | default(true) }}" create_home: "{{ user.create_home | default(true) }}"
comment: "User created by ansible" comment: "User created by ansible"
shell: "{{ item.shell | default('/bin/bash') }}" shell: "{{ user.shell | default('/bin/bash') }}"
password: "{{ item.password | default() }}" password: "{{ user.password | default() }}"
loop: "{{ _l3d_users__merged_users }}" loop: "{{ _l3d_users__merged_users }}"
loop_control: loop_control:
label: "user: ['{{ item.name }}']" label: "user={{ user.name }}"
when: item.state | default ('present') == 'present' loop_var: user
when: user.state | default ('present') == 'present'
- name: Remove Accounts for Users - name: Remove Accounts for Users
become: true become: true
ansible.builtin.user: ansible.builtin.user:
name: "{{ item.name }}" name: "{{ user.name }}"
state: 'absent' state: 'absent'
remove: "{{ item.remove | default(false) }}" remove: "{{ user.remove | default(false) }}"
loop: "{{ _l3d_users__merged_users }}" loop: "{{ _l3d_users__merged_users }}"
loop_control: loop_control:
label: "user: ['{{ item.name }}']" label: "user={{ user.name }}"
when: item.state | default ('present') == 'absent' and item.remove | default(false) | bool loop_var: user
when: user.state | default ('present') == 'absent' and user.remove | default(false) | bool
- name: Remove Groups for Users - name: Remove Groups for Users
become: true become: true
ansible.builtin.group: ansible.builtin.group:
name: "{{ item.name }}" name: "{{ user.name }}"
state: 'absent' state: 'absent'
loop: "{{ _l3d_users__merged_users }}" loop: "{{ _l3d_users__merged_users }}"
loop_control: loop_control:
label: "user: ['{{ item.name }}']" label: "user={{ user.name }}"
when: item.state | default ('present') == 'absent' and item.remove | default(false) | bool loop_var: user
when: user.state | default ('present') == 'absent' and user.remove | default(false) | bool

View file

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