From ab8d92a13968e8097fa1bf2a0601162c653baf25 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Thu, 18 Oct 2018 12:19:29 +0200 Subject: [PATCH] Add sudo entries --- tasks/user.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tasks/user.yml b/tasks/user.yml index 092ef7b..5b9af49 100644 --- a/tasks/user.yml +++ b/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([]) }}" + +