ansible-machine-setup/roles/sudo/tasks/main.yaml

23 lines
482 B
YAML
Raw Normal View History

2021-01-28 13:27:05 +00:00
---
- 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"