You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.9 KiB
YAML
59 lines
1.9 KiB
YAML
---
|
|
|
|
# updates loadbalancer config
|
|
|
|
# Parameters:
|
|
# playbook inventory
|
|
# stage := the name of the stage (e.g. dev, int, qa, prod)
|
|
|
|
#############################################################
|
|
# Creating inventory dynamically for given parameters
|
|
#############################################################
|
|
|
|
- hosts: localhost
|
|
gather_facts: false
|
|
connection: local
|
|
|
|
pre_tasks:
|
|
- name: "Check if ansible version is at least 2.10.x"
|
|
assert:
|
|
that:
|
|
- ansible_version.major >= 2
|
|
- ansible_version.minor >= 10
|
|
msg: "The ansible version has to be at least ({{ ansible_version.full }})"
|
|
|
|
# add virtual server to load stage specific variables as context
|
|
- name: "Add <{{ stage }}-virtual-host-to-read-groups-vars> to hosts"
|
|
add_host:
|
|
name: "{{ stage }}-virtual-host-to-read-groups-vars"
|
|
groups:
|
|
- "stage_{{ stage }}"
|
|
changed_when: False
|
|
|
|
#############################################################
|
|
# Creating inventory dynamically for given parameters
|
|
#############################################################
|
|
|
|
- hosts: "{{ stage }}-virtual-host-to-read-groups-vars"
|
|
serial: "{{ serial_number | default(1) }}"
|
|
gather_facts: false
|
|
connection: local
|
|
module_defaults:
|
|
hetzner.hcloud.hcloud_load_balancer:
|
|
api_token: "{{ hetzner_authentication_ansible }}"
|
|
hetzner.hcloud.hcloud_load_balancer_network:
|
|
api_token: "{{ hetzner_authentication_ansible }}"
|
|
hetzner.hcloud.hcloud_load_balancer_service:
|
|
api_token: "{{ hetzner_authentication_ansible }}"
|
|
hetzner.hcloud.hcloud_load_balancer_target:
|
|
api_token: "{{ hetzner_authentication_ansible }}"
|
|
|
|
tasks:
|
|
- name: "Setup base hcloud firewall rules"
|
|
include_role:
|
|
name: hcloud
|
|
tasks_from: _create_loadbalancer.yml
|
|
loop: "{{ hcloud_lb_objects }}"
|
|
loop_control:
|
|
loop_var: lb_object
|