christianlempa-boilerplates/ansible/provisoning/add_public_keys.yaml
2021-09-17 14:12:39 +02:00

26 lines
515 B
YAML

---
- hosts: all
become: yes
tasks:
# Installs public key
# --
#
- name: install public keys
ansible.posix.authorized_key:
user: "{{ lookup('env','USER') }}"
state: present
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
# (Optional)
# Set all sudoers to no password
# --
- name: change sudoers file
lineinfile:
path: /etc/sudoers
state: present
regexp: '^%sudo'
line: '%sudo ALL=(ALL) NOPASSWD: ALL'
validate: /usr/sbin/visudo -cf %s