--- - name: Create SSH key in Hetzner hetzner.hcloud.hcloud_ssh_key: api_token: "{{ hcloud_token }}" name: ansible-key public_key: "{{ hcloud_ssh_public_key }}" state: present register: ssh_key_result - name: Create Hetzner Cloud Server hetzner.hcloud.hcloud_server: api_token: "{{ hcloud_token }}" name: "{{ server_name }}" server_type: "{{ hcloud_server_type }}" image: "{{ hcloud_image }}" location: "{{ hcloud_location }}" ssh_keys: - ansible-key firewalls: "{{ hcloud_firewalls }}" state: present register: created_server - name: Show public IPv4 ansible.builtin.debug: var: created_server.hcloud_server.ipv4_address - name: Add new server to inventory add_host: name: newserver ansible_host: "{{ created_server.hcloud_server.ipv4_address }}" ansible_user: root ansible_ssh_private_key_file: "~/.ssh/id_ed25519"