This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
ansible-machine-setup/roles/sudo/tasks/main.yaml

23 lines
482 B
YAML

---
- name: install sudo
package:
name:
- sudo
state: latest
- name: add user to sudoer group
user:
name: "{{ account.name }}"
groups: "{{ sudo_group }}"
append: yes
- name: activate sudoers group
lineinfile:
dest: /etc/sudoers
state: present
regexp: "^%{{ sudo_group }}"
line: "%{{ sudo_group }} ALL=(ALL) ALL"
insertafter: "^#\\s*%{{ sudo_group }}"
firstmatch: true
validate: "visudo -cf %s"