system/tasks/sudoers.yml
vincent 1419eaa003
All checks were successful
continuous-integration/drone/push Build is passing
style: correct ansible lint
2022-12-10 20:25:54 +01:00

24 lines
651 B
YAML

- name: Set sudoers right
ansible.builtin.lineinfile:
dest: '/etc/sudoers.d/{{ user.name }}'
regexp: '{{ item.regexp }}'
line: '{{ item.line }}'
state: 'present'
create: True
owner: 'root'
group: 'root'
mode: '0440'
validate: 'visudo -cf "%s"'
with_items:
- regexp: '^{{ user.name }}\s'
line: '{{ user.name }} ALL = (ALL) NOPASSWD:ALL'
become: True
- name: Change secure path
ansible.builtin.replace:
path: '/etc/sudoers'
regexp: ^Defaults\s*secure_path.*
replace: Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
validate: 'visudo -cf "%s"'
become: true