Skip to content

Commit

Permalink
Fix hetzner module
Browse files Browse the repository at this point in the history
  • Loading branch information
jackivanov committed Feb 27, 2024
1 parent 74051d0 commit fdb50ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
7 changes: 2 additions & 5 deletions roles/cloud-hetzner/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
---
- name: Build python virtual environment
import_tasks: venv.yml

- name: Include prompts
import_tasks: prompts.yml

- name: Create an ssh key
hcloud_ssh_key:
hetzner.hcloud.ssh_key:
name: algo-{{ 999999 | random(seed=lookup('file', SSH_keys.public)) }}
public_key: "{{ lookup('file', SSH_keys.public) }}"
state: present
api_token: "{{ algo_hcloud_token }}"
register: hcloud_ssh_key

- name: Create a server...
hcloud_server:
hetzner.hcloud.server:
name: "{{ algo_server_name }}"
location: "{{ algo_hcloud_region }}"
server_type: "{{ cloud_providers.hetzner.server_type }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/cloud-hetzner/tasks/prompts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
algo_hcloud_token: "{{ hcloud_token | default(_hcloud_token.user_input|default(None)) | default(lookup('env','HCLOUD_TOKEN'), true) }}"

- name: Get regions
hcloud_datacenter_facts:
hetzner.hcloud.datacenter_info:
api_token: "{{ algo_hcloud_token }}"
register: _hcloud_regions

- name: Set facts about the regions
set_fact:
hcloud_regions: "{{ hcloud_datacenter_facts | sort(attribute='location') }}"
hcloud_regions: "{{ _hcloud_regions.hcloud_datacenter_info | sort(attribute='location') }}"

- name: Set default region
set_fact:
Expand Down
7 changes: 0 additions & 7 deletions roles/cloud-hetzner/tasks/venv.yml

This file was deleted.

0 comments on commit fdb50ae

Please sign in to comment.