Files
playbooks/prepare-server/roles/wheel/tasks/main.yaml
T

23 lines
637 B
YAML

---
- name: Ensure group wheel exists
ansible.builtin.group:
name: wheel
state: present
- name: Allow wheel group to have passwordless sudo
ansible.builtin.copy:
# A block scalar, so the file ends with a newline. With an inline string
# there is no trailing terminator and visudo rejects it with
# "syntax error: missing line terminator at end of file".
content: |
%wheel ALL=(ALL) NOPASSWD: ALL
dest: /etc/sudoers.d/wheel
mode: "0440"
validate: "/usr/sbin/visudo -cf %s"
- name: Adding user to group wheel
ansible.builtin.user:
name: "{{ user }}"
groups: wheel
append: true