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([]) }}" + +