mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Migrate to Hetzner cloud
This commit is contained in:
parent
d3c99dad0b
commit
c311cd4f7e
37 changed files with 416 additions and 299 deletions
13
roles/keepalived-hcloud/templates/config.json.j2
Normal file
13
roles/keepalived-hcloud/templates/config.json.j2
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"url": "https://api.hetzner.cloud/v1/floating_ips/{}/actions/assign",
|
||||
"api-token": "{{ hcloud_token_vip }}",
|
||||
"ips": [
|
||||
{
|
||||
"floating-ip-id": "{{ floating_ip_id }}",
|
||||
"floating-ip": "{{ floating_ip }}"
|
||||
}
|
||||
],
|
||||
"server-id": {{ hostvars[inventory_hostname]['id'] }},
|
||||
"interface": "eth0",
|
||||
"ip_bin_path": "/bin/ip"
|
||||
}
|
||||
41
roles/keepalived-hcloud/templates/keepalived.conf.j2
Normal file
41
roles/keepalived-hcloud/templates/keepalived.conf.j2
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
vrrp_script check_nginx {
|
||||
script /etc/keepalived/check_nginx.sh
|
||||
interval 3
|
||||
fall 5
|
||||
rise 1
|
||||
}
|
||||
|
||||
vrrp_instance VI_1 {
|
||||
{% if inventory_hostname == groups['kube-node'][0] %}
|
||||
state MASTER
|
||||
{% else %}
|
||||
state BACKUP
|
||||
{% endif %}
|
||||
priority 100
|
||||
interface eth0
|
||||
virtual_router_id 50
|
||||
|
||||
unicast_src_ip {{ hostvars[inventory_hostname]['ipv4'] }}
|
||||
unicast_peer {
|
||||
{% for host in (groups['kube-node']) %}
|
||||
{% if host != inventory_hostname %}
|
||||
{{ hostvars[host]['ipv4'] }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass "{{ keepalived_shared_secret }}"
|
||||
}
|
||||
|
||||
virtual_ipaddress {
|
||||
{{ floating_ip }}
|
||||
}
|
||||
|
||||
track_script {
|
||||
chk_haproxy
|
||||
}
|
||||
|
||||
notify /etc/keepalived/hcloud_failover.py
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue