Browse Source

Add sudo entries

Sven Velt 6 years atrás
parent
commit
ab8d92a139
1 changed files with 15 additions and 0 deletions
  1. 15 0
      tasks/user.yml

+ 15 - 0
tasks/user.yml

@@ -15,3 +15,18 @@
     shell: "{{ monitored_shell }}"
     state: present
 
+- name: "Install sudo (if required)"
+  package:
+    name: sudo
+    state: latest
+  when: monitored_sudo_commands|default([]) != []
+
+- name: Add sudo entries
+  lineinfile:
+    path: "{{ monitored_sudo_file }}"
+    line: "{{ item }}"
+    create: yes
+    backup: yes
+  with_items: "{{ monitored_sudo_commands|default([]) }}"
+
+