Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More platform independent setup #4

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ hetzner_installimage_install_partitions:
hetzner_installimage_install_image: /root/.oldroot/nfs/images/Debian-87-jessie-64-minimal.tar.gz
# prevent reinstallation of running servers with /etc/hostcode file
hetzner_installimage_ignore_hostcode: False
hetzner_installimage_after_reboot_timeout: 500
...
23 changes: 4 additions & 19 deletions tasks/installimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,14 @@
register: result

- name: reboot server
command: reboot
async: 0
poll: 0
ignore_errors: true
reboot:
reboot_timeout: '{{ hetzner_installimage_after_reboot_timeout }}'

- name: remove server from local known_hosts file
local_action: shell ssh-keygen -R {{ ansible_host }}

- name: pause a bit for the reboot to kick in
pause: seconds=60

- name: waiting for server to come back
local_action: wait_for
host={{ ansible_host }}
port=22
delay=1
timeout=180

- name: update apt
raw: apt-get update

- name: install python on remote host
raw: apt-get install python -y
- name: do facts module to get latest information
setup:

- name: generate hostcode
set_fact:
Expand Down
3 changes: 2 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
- name: include installimage
include: installimage.yml
when: hetzner_installimage_run and hetzner_installimage_rescue.json.rescue.active == false and not ansible_check_mode

vars:
ansible_port: 22
...
1 change: 1 addition & 0 deletions tasks/rescuemode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

- name: remove server from local known_hosts file
local_action: shell ssh-keygen -R {{ ansible_host }}
ignore_errors: true

- name: pause a bit for the hardware reset to kick in
pause: seconds=15
Expand Down