christianlempa-boilerplates/ansible/configuration/ssh/config-add-sshkey.yaml

20 lines
504 B
YAML
Raw Normal View History

2021-06-11 15:01:45 +02:00
---
- name: Add ssh key
hosts: "{{ my_hosts | d([]) }}"
become: true
2021-06-11 15:01:45 +02:00
tasks:
- name: Install public keys
2024-03-03 16:10:27 +01:00
ansible.posix.authorized_key:
user: "{{ lookup('env','USER') }}"
state: present
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
- name: Change sudoers file
2024-03-03 16:10:27 +01:00
ansible.builtin.lineinfile:
path: /etc/sudoers
state: present
regexp: '^%sudo'
line: '%sudo ALL=(ALL) NOPASSWD: ALL'
validate: /usr/sbin/visudo -cf %s