From dd89fb3261a42d8e8deba7f1fa237cfa1b7180f7 Mon Sep 17 00:00:00 2001 From: Tiago Carrondo Date: Thu, 3 Mar 2022 22:43:09 +0000 Subject: [PATCH] =?UTF-8?q?primeira=20vers=C3=A3o=20da=20role?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/utilizadores/tasks/main.yml | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 roles/utilizadores/tasks/main.yml diff --git a/roles/utilizadores/tasks/main.yml b/roles/utilizadores/tasks/main.yml new file mode 100644 index 0000000..e73d5a3 --- /dev/null +++ b/roles/utilizadores/tasks/main.yml @@ -0,0 +1,45 @@ +--- +# Grupo ansoladm + +- name: Create group 'ansoladm' + group: + name: ansoladm + state: present +- name: 'Allow ansoladm users to sudo without a password' + lineinfile: + dest: '/etc/sudoers' + state: 'present' + regexp: '^%ansoladm' + line: '%ansoladm ALL=(ALL) NOPASSWD: ALL' + +# Tiago Carrondo + +- name: Add user 'tc' + become: true + user: + name: tc + shell: /bin/bash + groups: ansoladm + append: yes +- name: Add 'tc' authorized keys + become: true + authorized_key: + user: tc + state: present + key: https://github.com/tcarrondo.keys + +# Hugo Peixoto + +- name: Add user 'hugopeixoto' + become: true + user: + name: hugopeixoto + shell: /bin/bash + groups: ansoladm + append: yes +- name: Add 'hugopeixoto' authorized keys + become: true + authorized_key: + user: hugopeixoto + state: present + key: https://github.com/hugopeixoto.keys