summaryrefslogtreecommitdiff
path: root/roles/cloud/install/tasks
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2022-01-01 20:19:56 +0100
committerChristian Pointner <equinox@spreadspace.org>2022-01-01 20:19:56 +0100
commitd90144d2190009f8bd121cb8f773a9209500f034 (patch)
tree2d258279d2179afc58fd91c741e0b5fa56246c9f /roles/cloud/install/tasks
parentMerge branch 'topic/revamp-openwrt-imag-gen' (diff)
in-place variable cooking
Diffstat (limited to 'roles/cloud/install/tasks')
-rw-r--r--roles/cloud/install/tasks/hcloud.yml10
-rw-r--r--roles/cloud/install/tasks/hroot.yml22
2 files changed, 16 insertions, 16 deletions
diff --git a/roles/cloud/install/tasks/hcloud.yml b/roles/cloud/install/tasks/hcloud.yml
index b716f4ac..cd46d348 100644
--- a/roles/cloud/install/tasks/hcloud.yml
+++ b/roles/cloud/install/tasks/hcloud.yml
@@ -6,7 +6,7 @@
url: "https://api.hetzner.cloud/v1/ssh_keys"
method: GET
headers:
- Authorization: "Bearer {{ install_cooked.cloud.credentials.token }}"
+ Authorization: "Bearer {{ install.cloud.credentials.token }}"
status_code: 200
register: sshkeys
@@ -14,10 +14,10 @@
delegate_to: localhost
check_mode: no
uri:
- url: "https://api.hetzner.cloud/v1/servers?name={{ install_cooked.cloud.server_name | default(inventory_hostname) }}"
+ url: "https://api.hetzner.cloud/v1/servers?name={{ install.cloud.server_name | default(inventory_hostname) }}"
method: GET
headers:
- Authorization: "Bearer {{ install_cooked.cloud.credentials.token }}"
+ Authorization: "Bearer {{ install.cloud.credentials.token }}"
status_code: 200
register: serverstatus
@@ -48,7 +48,7 @@
method: POST
body: "{{ {'type': 'linux64', 'ssh_keys': (sshkeys.json.ssh_keys | map(attribute='id') | list) } | to_nice_json }}"
headers:
- Authorization: "Bearer {{ install_cooked.cloud.credentials.token }}"
+ Authorization: "Bearer {{ install.cloud.credentials.token }}"
Content-Type: "application/json"
status_code: 201
@@ -62,7 +62,7 @@
url: "https://api.hetzner.cloud/v1/servers/{{ serverstatus.json.servers[0].id }}/actions/reset"
method: POST
headers:
- Authorization: "Bearer {{ install_cooked.cloud.credentials.token }}"
+ Authorization: "Bearer {{ install.cloud.credentials.token }}"
status_code: 201
### TODO: would be nice to get the SSH host key from robot
diff --git a/roles/cloud/install/tasks/hroot.yml b/roles/cloud/install/tasks/hroot.yml
index 1ff4a55d..588ae981 100644
--- a/roles/cloud/install/tasks/hroot.yml
+++ b/roles/cloud/install/tasks/hroot.yml
@@ -5,8 +5,8 @@
uri:
url: "https://robot-ws.your-server.de/key"
method: GET
- user: "{{ install_cooked.cloud.credentials.username }}"
- password: "{{ install_cooked.cloud.credentials.password }}"
+ user: "{{ install.cloud.credentials.username }}"
+ password: "{{ install.cloud.credentials.password }}"
force_basic_auth: yes
status_code: 200
register: sshkeys
@@ -19,15 +19,15 @@
uri:
url: "https://robot-ws.your-server.de/server"
method: GET
- user: "{{ install_cooked.cloud.credentials.username }}"
- password: "{{ install_cooked.cloud.credentials.password }}"
+ user: "{{ install.cloud.credentials.username }}"
+ password: "{{ install.cloud.credentials.password }}"
force_basic_auth: yes
status_code: 200
register: servers
- name: extract server IP address from robot result
set_fact:
- hetzner_main_ip: "{{ servers.json | hroot_extract_serverip(install_cooked.cloud.server_name | default(inventory_hostname)) }}"
+ hetzner_main_ip: "{{ servers.json | hroot_extract_serverip(install.cloud.server_name | default(inventory_hostname)) }}"
- name: do not continue in check mode
when: ansible_check_mode | bool
@@ -48,8 +48,8 @@
uri:
url: "https://robot-ws.your-server.de/boot/{{ hetzner_main_ip }}/rescue"
method: GET
- user: "{{ install_cooked.cloud.credentials.username }}"
- password: "{{ install_cooked.cloud.credentials.password }}"
+ user: "{{ install.cloud.credentials.username }}"
+ password: "{{ install.cloud.credentials.password }}"
force_basic_auth: yes
status_code: 200
register: rescuestatus
@@ -61,8 +61,8 @@
uri:
url: "https://robot-ws.your-server.de/boot/{{ hetzner_main_ip }}/rescue"
method: POST
- user: "{{ install_cooked.cloud.credentials.username }}"
- password: "{{ install_cooked.cloud.credentials.password }}"
+ user: "{{ install.cloud.credentials.username }}"
+ password: "{{ install.cloud.credentials.password }}"
force_basic_auth: yes
body: "os=linux&arch=64&authorized_key[]={{ sshkeys.json | hroot_extract_ssh_key_fingerprints | join('&authorized_key[]=') }}"
status_code: 200
@@ -78,8 +78,8 @@
uri:
url: "https://robot-ws.your-server.de/reset/{{ hetzner_main_ip }}"
method: POST
- user: "{{ install_cooked.cloud.credentials.username }}"
- password: "{{ install_cooked.cloud.credentials.password }}"
+ user: "{{ install.cloud.credentials.username }}"
+ password: "{{ install.cloud.credentials.password }}"
force_basic_auth: yes
body: "type=hw" ## type=sw -> CTRL-ALT-DEL, type=hw -> reset button
status_code: 200