ansible_proxmox_vms/playbooks/add-ssh-key.yml

16 lines
377 B
YAML
Raw Normal View History

---
- name: Add SSH public key to VM user
hosts: proxmox_vms
gather_facts: false
vars:
target_user: vrubel
key_file: "{{ lookup('env', 'HOME') }}/.ssh/id_ed25519.pub"
tasks:
- name: Add public key to authorized_keys
ansible.posix.authorized_key:
user: "{{ target_user }}"
state: present
key: "{{ lookup('file', key_file) }}"