You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/hetzner_ssh_keys.yml

16 lines
569 B
YAML

---
- name: 'upload ssh keys for root access to hetzner cloud'
hosts: '{{ host | default("all") }}'
gather_facts: false
connection: local
pre_tasks:
- name: "add ssh key for root access"
hetzner.hcloud.hcloud_ssh_key:
api_token: "{{ hetzner_authentication_ansible }}"
name: "{{ lookup('file', 'users/' + item + '/ssh.pub').split(' ') | last }}"
public_key: "{{ lookup('file', 'users/' + item + '/ssh.pub') }}"
state: "{{ ssh_key_state | default('present') }}"
loop: '{{ hetzner_ssh_keys }}'
run_once: true