ansible/roles/utilizadores/tasks/main.yml

36 lines
704 B
YAML
Raw Permalink Normal View History

2022-03-03 22:43:09 +00:00
---
# 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'
2022-03-03 23:11:02 +00:00
# Utilizadores e chaves
2022-03-03 22:43:09 +00:00
2022-03-03 23:11:02 +00:00
- name: Add user(s)
2022-03-03 22:43:09 +00:00
become: true
user:
2022-03-03 23:11:02 +00:00
name: '{{ item.name }}'
2022-03-03 22:43:09 +00:00
shell: /bin/bash
2022-03-06 14:55:33 +00:00
groups:
- ansoladm
- lxd
2022-03-03 22:43:09 +00:00
append: yes
2022-03-03 23:11:02 +00:00
with_items:
- '{{utilizadores}}'
- name: Add authorized key(s)
2022-03-03 22:43:09 +00:00
become: true
authorized_key:
2022-03-03 23:11:02 +00:00
user: '{{ item.name }}'
2022-03-03 22:43:09 +00:00
state: present
2022-03-03 23:11:02 +00:00
key: https://github.com/{{ item.github }}.keys
with_items:
- '{{utilizadores}}'