Skip to content

Commit

Permalink
Create correct sudoer group per distro
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
EconomicTouristsArmLate authored Apr 30, 2024
1 parent c9bf1a1 commit 94b8b59
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion molecule_qemu/playbooks/templates/user-data.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 94b8b59

Please sign in to comment.