add sudoers

This commit is contained in:
vincent 2022-11-11 17:48:09 +01:00
parent f59ad01087
commit 7e4be72128
2 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,7 @@
- include_tasks: time.yml - include_tasks: time.yml
- include_tasks: usergroup.yml - include_tasks: usergroup.yml
- include_tasks: ssh.yml - include_tasks: ssh.yml
- include_tasks: sudoers.yml
- include_tasks: pacman.yml - include_tasks: pacman.yml
when: ansible_facts['os_family'] == "Archlinux" when: ansible_facts['os_family'] == "Archlinux"
- include_tasks: firewalld.yml - include_tasks: firewalld.yml

View File

@ -0,0 +1,15 @@
- name: set sudoers right
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