瀏覽代碼

Add sudo entries

Sven Velt 6 年之前
父節點
當前提交
ab8d92a139
共有 1 個文件被更改,包括 15 次插入0 次删除
  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([]) }}"
+
+