Refactor Ansible tasks and templates for improved consistency and clarity

This commit is contained in:
2026-07-31 02:24:42 +02:00
parent 81ef678904
commit 46327da2ac
52 changed files with 1679 additions and 1461 deletions
+10 -11
View File
@@ -5,10 +5,10 @@
# ---
- name: (user.yml) Remove (old) users from system
user:
ansible.builtin.user:
name: '{{ item.name }}'
state: absent
with_items:
with_items:
- "{{ remove_system_users }}"
loop_control:
label: '{{ item.name }}'
@@ -16,10 +16,10 @@
- system-user
- name: (user.yml) Remove home directory from deleted users
file:
ansible.builtin.file:
path: '{{ base_home }}/{{ item.name }}'
state: absent
with_items:
with_items:
- "{{ remove_system_users }}"
loop_control:
label: '{{ item.name }}'
@@ -31,7 +31,7 @@
# ---
- name: (user.yml) Ensure system groups exists
group:
ansible.builtin.group:
name: '{{ item.name }}'
state: present
gid: '{{ item.group_id | default(omit) }}'
@@ -42,17 +42,17 @@
notify: Renew nis databases
tags:
- system-user
#- meta: end_host
# - meta: end_host
- name: (system-user.yml) Get database of nis (system) users
getent:
ansible.builtin.getent:
database: passwd
tags:
- system-user
- name: (system-user.yml) Add (system) users if not yet exists..
shell: "/root/bin/admin-stuff/add_new_user.sh {{ item.name }} '{{ item.password }}'"
ansible.builtin.command: "/root/bin/admin-stuff/add_new_user.sh {{ item.name }} '{{ item.password }}'"
changed_when: true
loop: "{{ system_users }}"
loop_control:
label: '{{ item.name }}'
@@ -62,4 +62,3 @@
notify: Renew nis databases
tags:
- system-user