Add ability for sudo access

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-01-07 18:40:34 +01:00
parent 320345868d
commit 776fd91ffb
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -39,3 +39,20 @@
group: '{{ item.name }}'
when: item.github_key_user is defined and item.ssh_key is not defined
with_items: '{{ users }}'
- name: Set up sudo access for user
copy:
content: |
{{ item.name }} ALL=(ALL) NOPASSWD: ALL
dest: '/etc/sudoers.d/{{ item.name }}'
when: item.sudo is defined and item.sudo
with_items: '{{ users }}'
- name: Revoke sudo access for user
file:
dest: '/etc/sudoers.d/{{ item.name }}'
state: absent
when: item.sudo is not defined or not item.sudo
with_items: '{{ users }}'
...