summaryrefslogtreecommitdiff
path: root/roles/cloud
diff options
context:
space:
mode:
Diffstat (limited to 'roles/cloud')
-rw-r--r--roles/cloud/install/tasks/hcloud.yml10
-rw-r--r--roles/cloud/install/tasks/hroot.yml22
-rw-r--r--roles/cloud/install/templates/hetzner_installimage.conf.j212
-rw-r--r--roles/cloud/install/templates/hetzner_postinst.sh.j24
4 files changed, 24 insertions, 24 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
diff --git a/roles/cloud/install/templates/hetzner_installimage.conf.j2 b/roles/cloud/install/templates/hetzner_installimage.conf.j2
index e3cd4c4e..acdf42c4 100644
--- a/roles/cloud/install/templates/hetzner_installimage.conf.j2
+++ b/roles/cloud/install/templates/hetzner_installimage.conf.j2
@@ -1,25 +1,25 @@
HOSTNAME {{ host_name }}{% if host_domain %}.{{ host_domain }}{% endif %}{{ '' }}
{% if cloud_provider == "hroot" %}
-{% if install_cooked.disks.primary == "software-raid" %}
-{% for raid_member in install_cooked.disks.raid.members %}
+{% if install.disks.primary == "software-raid" %}
+{% for raid_member in install.disks.raid.members %}
DRIVE{{ loop.index }} {{ raid_member }}
{% endfor %}
SWRAID 1
-SWRAIDLEVEL {{ install_cooked.disks.raid.level }}
+SWRAIDLEVEL {{ install.disks.raid.level }}
{% else %}
-DRIVE1 {{ install_cooked.disks.primary }}
+DRIVE1 {{ install.disks.primary }}
{% endif %}
{% elif cloud_provider == "hcloud" %}
DRIVE1 /dev/sda
{% endif %}
BOOTLOADER grub
PART /boot ext4 {{ hetzner_boot_size }}
-{% set system_lvm_size = install_cooked.system_lvm.size | default(hetzner_system_lvm_size_default) %}
+{% set system_lvm_size = install.system_lvm.size | default(hetzner_system_lvm_size_default) %}
PART lvm {{ host_name }} {{ system_lvm_size }}
{% if system_lvm_size != "all" %}
PART /dummy ext4 all
{% endif %}
-{% set system_lvm_volumes = install_cooked.system_lvm.volumes | default(hetzner_system_lvm_volumes_default) %}
+{% set system_lvm_volumes = install.system_lvm.volumes | default(hetzner_system_lvm_volumes_default) %}
{% for volume in system_lvm_volumes %}
LV {{ host_name }} {{ volume.name }} {{ volume.mountpoint }} {{ volume.filesystem }} {{ volume.size }}
{% endfor %}
diff --git a/roles/cloud/install/templates/hetzner_postinst.sh.j2 b/roles/cloud/install/templates/hetzner_postinst.sh.j2
index 8f923313..ba9d3eeb 100644
--- a/roles/cloud/install/templates/hetzner_postinst.sh.j2
+++ b/roles/cloud/install/templates/hetzner_postinst.sh.j2
@@ -22,7 +22,7 @@ passwd -d root && passwd -l root
{% if install_distro == "debian" %}
sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces
{% endif %}
-{% set system_lvm_volumes = install_cooked.system_lvm.volumes | default(hetzner_system_lvm_volumes_default) %}
+{% set system_lvm_volumes = install.system_lvm.volumes | default(hetzner_system_lvm_volumes_default) %}
{% for volume in system_lvm_volumes %}
{% if 'mount_options' in volume %}
sed -r 's#(\s+{{ volume.mountpoint }}\s+{{ volume.filesystem }}\s+)defaults#\1{{ volume.mount_options | join(",") }}#g' -i /etc/fstab
@@ -42,7 +42,7 @@ swapoff -a
sed -e '/^\/swapfile/d' -i /etc/fstab
rm -f /swapfile
-{% set system_lvm_size = install_cooked.system_lvm.size | default('all') %}
+{% set system_lvm_size = install.system_lvm.size | default('all') %}
{% if system_lvm_size != "all" %}
sed -e '/\/dummy/d' -i /etc/fstab