sudo rights for administrator without password and copying of authorized keyes

This commit is contained in:
Kevin Veen-Birkenbach 2020-12-25 15:38:42 +01:00
parent 0c4031ba73
commit 07281e9e49
2 changed files with 15 additions and 2 deletions

View File

@ -4,7 +4,7 @@
- name: create sudoers
template: src=sudoers dest=/etc/sudoers
- name: ensure group "sudo" exists
- name: insure group "sudo" exists
group:
name: sudo
state: present

View File

@ -4,4 +4,17 @@
generate_ssh_key: yes
ssh_key_bits: 4096
ssh_key_file: .ssh/id_rsa
group: sudo
group: administrator
- name: create /home/administrator/.ssh/authorized_keys
copy:
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}/home/administrator/.ssh/authorized_keys"
dest: /home/administrator/.ssh/authorized_keys
owner: administrator
group: administrator
mode: '0644'
- name: grant administrator sudo rights without password
copy:
content: '%administrator ALL=(ALL) NOPASSWD: ALL'
dest: /etc/sudoers.d/administrator