From 94b8b598f683bc9b61463928a2a2860e74792af7 Mon Sep 17 00:00:00 2001 From: EconomicTouristsArmLate <139865170+EconomicTouristsArmLate@users.noreply.github.com> Date: Tue, 30 Apr 2024 20:57:22 +0200 Subject: [PATCH] Create correct sudoer group per distro On Debian based distros, there is no `wheel`, on Redhat there is no `sudo`. This avoids creating the superfluous group, which would occupy GID 1000. --- molecule_qemu/playbooks/templates/user-data.j2 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/molecule_qemu/playbooks/templates/user-data.j2 b/molecule_qemu/playbooks/templates/user-data.j2 index e5e91f6..a7319d9 100644 --- a/molecule_qemu/playbooks/templates/user-data.j2 +++ b/molecule_qemu/playbooks/templates/user-data.j2 @@ -7,7 +7,14 @@ users: - {{ ssh_keypair.public_key }} {% if item.network_ssh_user != 'root' -%} - name: {{ item.network_ssh_user }} - groups: admin,users,sudo,wheel + groups: + - admin + - users + {% if ansible_os_family == 'Debian' -%} + - sudo + {% elif ansible_os_family == 'RedHat' -%} + - wheel + {%- endif +%} shell: /bin/bash sudo: ["ALL=(ALL) NOPASSWD:ALL"] lock_passwd: true