summaryrefslogtreecommitdiff
path: root/roles/cloud/install/tasks/hroot.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/cloud/install/tasks/hroot.yml')
-rw-r--r--roles/cloud/install/tasks/hroot.yml31
1 files changed, 15 insertions, 16 deletions
diff --git a/roles/cloud/install/tasks/hroot.yml b/roles/cloud/install/tasks/hroot.yml
index 9124f44a..b7d511a0 100644
--- a/roles/cloud/install/tasks/hroot.yml
+++ b/roles/cloud/install/tasks/hroot.yml
@@ -1,5 +1,7 @@
---
- name: retrieve ssh key fingerprints
+ delegate_to: localhost
+ check_mode: no
uri:
url: "https://robot-ws.your-server.de/key"
method: GET
@@ -8,18 +10,12 @@
force_basic_auth: yes
status_code: 200
register: sshkeys
- delegate_to: localhost
- check_mode: no
-
-- name: do not continue in check mode
- fail:
- msg: "can not bootstrap new servers in check mode"
- when: ansible_check_mode | bool
- check_mode: no
- when: hetzner_main_ip is not defined
block:
- name: retrieve server list from robot
+ delegate_to: localhost
+ check_mode: no
uri:
url: "https://robot-ws.your-server.de/server"
method: GET
@@ -28,13 +24,16 @@
force_basic_auth: yes
status_code: 200
register: servers
- delegate_to: localhost
- check_mode: no
- 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)) }}"
+- name: do not continue in check mode
+ when: ansible_check_mode | bool
+ fail:
+ msg: "can not bootstrap new servers in check mode"
+
- name: display warning message
pause:
prompt: |
@@ -44,6 +43,8 @@
seconds: 15
- name: check if rescue mode is already active
+ delegate_to: localhost
+ check_mode: no
uri:
url: "https://robot-ws.your-server.de/boot/{{ hetzner_main_ip }}/rescue"
method: GET
@@ -52,12 +53,11 @@
force_basic_auth: yes
status_code: 200
register: rescuestatus
- delegate_to: localhost
- check_mode: no
### TODO: for now we add all ssh keys that are installed in the robot - this might not be a good idea!
- name: activate rescue mode
when: not rescuestatus.json.rescue.active
+ delegate_to: localhost
uri:
url: "https://robot-ws.your-server.de/boot/{{ hetzner_main_ip }}/rescue"
method: POST
@@ -68,13 +68,13 @@
status_code: 200
headers:
Content-Type: "application/x-www-form-urlencoded"
- delegate_to: localhost
-- name: wait for the rescue mode to become active
+- name: wait for rescue mode activation
pause:
seconds: 5
- name: do a hardware reset
+ delegate_to: localhost
uri:
url: "https://robot-ws.your-server.de/reset/{{ hetzner_main_ip }}"
method: POST
@@ -85,7 +85,6 @@
status_code: 200
headers:
Content-Type: "application/x-www-form-urlencoded"
- delegate_to: localhost
### TODO: would be nice to get the SSH host key from robot
- name: completely ignore ssh host keys for now
@@ -98,7 +97,7 @@
delay: 30
timeout: 120
-- include_tasks: hetzner_installimage.yml
+- import_tasks: hetzner_installimage.yml
- name: reboot
shell: sleep 2 && shutdown -r now "triggered by ansible after running installimage"