Skip to content

Commit

Permalink
use dedicated primary ip for hcloud_load_balancer_target tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Sep 6, 2023
1 parent bb28f64 commit d5e5ce2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
hcloud_server_name: "{{ hcloud_ns }}"
hcloud_primary_ip_name: "{{ hcloud_ns }}"
hcloud_load_balancer_name: "{{ hcloud_ns }}"
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
that:
- server is success

- name: setup primary_ip
hetzner.hcloud.hcloud_primary_ip:
name: "{{ hcloud_primary_ip_name }}"
state: present
location: fsn1
register: primary_ip

- name: setup load_balancer
hetzner.hcloud.hcloud_load_balancer:
name: "{{hcloud_load_balancer_name}}"
Expand Down Expand Up @@ -123,15 +130,15 @@
hetzner.hcloud.hcloud_load_balancer_target:
type: "ip"
load_balancer: "{{ hcloud_load_balancer_name }}"
ip: "{{ server.hcloud_server.ipv4_address }}"
ip: "{{ primary_ip.hcloud_primary_ip.ip }}"
state: present
register: load_balancer_target
- name: verify create ip target
assert:
that:
- load_balancer_target is changed
- load_balancer_target.hcloud_load_balancer_target.type == "ip"
- load_balancer_target.hcloud_load_balancer_target.ip == server.hcloud_server.ipv4_address
- load_balancer_target.hcloud_load_balancer_target.ip == primary_ip.hcloud_primary_ip.ip
- load_balancer_target.hcloud_load_balancer_target.load_balancer == hcloud_load_balancer_name

- name: cleanup load_balancer
Expand Down

0 comments on commit d5e5ce2

Please sign in to comment.