ansible/playbooks/distrib_ssh_keys.yml
ladislav.dusa afc7817a81 conf added
2024-12-11 16:33:42 +01:00

34 lines
794 B
YAML
Executable File

- hosts: "{{ hosts }}"
become: true
tasks:
# Deploy SSH Key
# --
- name: Download id_rsa
ansible.builtin.get_url:
url: http://192.168.77.106:48000/ssh/id_rsa
dest: ~/.ssh/id_rsa
mode: '0600'
- name: Download foo.conf
ansible.builtin.get_url:
url: http://192.168.77.106:48000/ssh/id_rsa.pub
dest: ~/.ssh/id_rsa.pub
mode: '0600'
- name: install public keys
ansible.posix.authorized_key:
user: "{{ user }}"
state: present
key: "{{ lookup('file', new_ssh_key_file) }}"
# 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