From 20303d37f08d171804c56109144c5c9344bdf54a Mon Sep 17 00:00:00 2001 From: rubenb Date: Wed, 11 Oct 2023 16:28:15 +0200 Subject: [PATCH] add install sudo and add awx-user to sudo --- .../tasks/main.yaml | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/linux/base-config-debian/roles/create-awx-user-and-config/tasks/main.yaml b/linux/base-config-debian/roles/create-awx-user-and-config/tasks/main.yaml index 58eae81..aecf7bc 100644 --- a/linux/base-config-debian/roles/create-awx-user-and-config/tasks/main.yaml +++ b/linux/base-config-debian/roles/create-awx-user-and-config/tasks/main.yaml @@ -1,8 +1,5 @@ --- -# vars files -# vars_files: - # create user awx-user on debian os - name: Create a ssh user awx-user in the system user: @@ -19,4 +16,24 @@ user: awx-user key: "{{ key_to_add }}" +# install sudo package +- name: Install sudo package + apt: + name: sudo + state: present + + # add awx-user to sudoers +- name: Add awx-user to sudoers + file: + path: /etc/sudoers.d/awx-user + state: touch + mode: u=rw,g=r,o=r + +# add a line to /etc/sudoers.d/awx-user file +- name: add a line to /etc/sudoers.d/awx-user file + lineinfile: + path: /etc/sudoers.d/awx-user + line: awx-user ALL=(ALL) NOPASSWD:ALL + +