2019-11-03 21:40:04 +00:00
|
|
|
---
|
2024-02-18 12:37:23 +00:00
|
|
|
- name: Install requirements
|
|
|
|
ansible.builtin.package:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
loop: "{{ sudo_packages }}"
|
2022-09-19 14:45:34 +00:00
|
|
|
|
2024-02-18 12:37:23 +00:00
|
|
|
- name: Add base sudo config
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: etc/sudoers.j2
|
|
|
|
dest: /etc/sudoers
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0440"
|
|
|
|
validate: "/usr/sbin/visudo -cf %s"
|
2022-09-19 14:45:34 +00:00
|
|
|
|
2024-02-18 12:37:23 +00:00
|
|
|
- name: Add config files to sudoers.d
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: etc/sudoers.d/sudo_ext.j2
|
|
|
|
dest: "/etc/sudoers.d/{{ item.name }}"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0440"
|
|
|
|
validate: "/usr/sbin/visudo -cf %s"
|
|
|
|
loop: "{{ sudo_aliases }}"
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.name }}"
|
|
|
|
when:
|
|
|
|
- sudo_aliases is defined
|
|
|
|
- item.user_aliases is defined
|