Update Ansible/user-anlegen.sh

This commit is contained in:
2025-08-10 06:42:33 +00:00
parent bab82668e5
commit da2fc1a5bb

View File

@@ -22,25 +22,25 @@ fi
# Funktion: Ansible-Benutzer unter RHEL/AlmaLinux/CentOS # Funktion: Ansible-Benutzer unter RHEL/AlmaLinux/CentOS
setup_rhel() { setup_rhel() {
printf "${BLUE}→ RHEL/AlmaLinux erkannt Benutzer wird mit useradd erstellt${NC}\n" printf "${BLUE}→ RHEL/AlmaLinux erkannt - Benutzer wird mit useradd erstellt${NC}\n"
sudo useradd -m -s /bin/bash "$USERNAME" sudo useradd -m -s /bin/bash "$USERNAME"
} }
# Funktion: Ansible-Benutzer unter Debian/Ubuntu # Funktion: Ansible-Benutzer unter Debian/Ubuntu
setup_debian() { setup_debian() {
printf "${BLUE}→ Debian/Ubuntu erkannt Benutzer wird mit adduser erstellt${NC}\n" printf "${BLUE}→ Debian/Ubuntu erkannt - Benutzer wird mit adduser erstellt${NC}\n"
sudo adduser --disabled-password --gecos "" "$USERNAME" sudo adduser --disabled-password --gecos "" "$USERNAME"
} }
# Funktion: Ansible-Benutzer unter Alpine # Funktion: Ansible-Benutzer unter Alpine
setup_alpine() { setup_alpine() {
printf "${BLUE}→ Alpine Linux erkannt Benutzer wird mit adduser erstellt${NC}\n" printf "${BLUE}→ Alpine Linux erkannt - Benutzer wird mit adduser erstellt${NC}\n"
sudo adduser -D -s /bin/sh "$USERNAME" sudo adduser -D -s /bin/sh "$USERNAME"
} }
# Hauptlogik # Hauptlogik
if id "$USERNAME" >/dev/null 2>&1; then if id "$USERNAME" >/dev/null 2>&1; then
printf "${YELLOW}↷ Benutzer $USERNAME existiert bereits überspringe Erstellung${NC}\n" printf "${YELLOW}↷ Benutzer $USERNAME existiert bereits - überspringe Erstellung${NC}\n"
else else
case "$OS_ID" in case "$OS_ID" in
almalinux|centos|rhel|rocky) almalinux|centos|rhel|rocky)