dsfg
This commit is contained in:
parent
31b48cb6c8
commit
06b5260fc2
1 changed files with 7 additions and 8 deletions
|
@ -38,14 +38,13 @@
|
||||||
#no_log: true
|
#no_log: true
|
||||||
|
|
||||||
- name: Ensure users are added to sudoers
|
- name: Ensure users are added to sudoers
|
||||||
community.general.sudoers:
|
ansible.builtin.blockinfile:
|
||||||
name: "users-sudo-{{ item.username }}"
|
create: true # todo extra task fur abbau
|
||||||
state: "{{ item.state | default('present') }}"
|
path: "/etc/sudoers.d/users-sudo-{{ item.username }}"
|
||||||
user: "{{ item.username }} ALL=(ALL)"
|
state: present
|
||||||
commands: "ALL"
|
block: |
|
||||||
host: "ALL"
|
{{ item.username }} ALL=(ALL) {{ 'NOPASSWD:' if (item.allow_passwordless_sudo | d(false)) else '' }}ALL
|
||||||
nopassword: "{{ item.allow_passwordless_sudo }}"
|
validate: 'visudo -cf %s'
|
||||||
validation: absent #todo required
|
|
||||||
loop: '{{ users }}'
|
loop: '{{ users }}'
|
||||||
when: item.allow_sudo|default(false) and item.allow_sudo is defined
|
when: item.allow_sudo|default(false) and item.allow_sudo is defined
|
||||||
#no_log: true
|
#no_log: true
|
||||||
|
|
Loading…
Reference in a new issue