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

hcloud_load_balancer_service fails to be created with health_check when load balancer service does not exist #158

Open
s4ke opened this issue Oct 23, 2022 · 2 comments
Assignees
Labels
bug Something isn't working pinned

Comments

@s4ke
Copy link

s4ke commented Oct 23, 2022

SUMMARY

hcloud_load_balancer_service fails to be created with health_check when load balancer service does not exist

ISSUE TYPE
  • Bug Report
COMPONENT NAME

hcloud_load_balancer_service

ANSIBLE VERSION
ansible [core 2.13.5]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/martinb/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/martinb/neuroforge_projects/github/swarmsible-hetzner/swarmsible-hetzner/venv/lib/python3.8/site-packages/ansible
  ansible collection location = /home/martinb/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/martinb/neuroforge_projects/github/swarmsible-hetzner/swarmsible-hetzner/venv/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /home/martinb/neuroforge_projects/github/swarmsible-hetzner/swarmsible-hetzner/venv/lib/python3.8/site-packages/ansible_collections
Collection     Version
-------------- -------
hetzner.hcloud 1.8.2  

# /home/martinb/.ansible/collections/ansible_collections
Collection     Version
-------------- -------
hetzner.hcloud 1.8.2  
CONFIGURATION

OS / ENVIRONMENT

Kubuntu 20.04

STEPS TO REPRODUCE

Use the following task:

- name: Create Load Balancer service with Port 443
  hetzner.hcloud.hcloud_load_balancer_service:
    api_token: "{{ hcloud_token }}"
    load_balancer: "swarmlb"
    protocol: https
    listen_port: 443
    state: present
    health_check:
      http:
        status_codes:
          - "404"
        tls: no
    http:
      redirect_http: true
      certificates:
        - "{{ swarm_lb_certificate_name }}"

Run on a project without the load balancer existing

EXPECTED RESULTS

The load balancer being created successful

ACTUAL RESULTS

The error is

fatal: [localhost]: FAILED! => {"changed": false, "msg": "invalid input in field 'health_check'"}

If we create the load balancer with no custom health_check before it works:

- name: Create Load Balancer service with Port 443 (work around, creating a new load balancer with health_check fails)
  hetzner.hcloud.hcloud_load_balancer_service:
    api_token: "{{ hcloud_token }}"
    load_balancer: "swarmlb"
    protocol: https
    listen_port: 443
    state: present
    http:
      redirect_http: true
      certificates:
        - "{{ swarm_lb_certificate_name }}"
  when: not swarm_lb_found | bool
@github-actions
Copy link

github-actions bot commented Oct 9, 2023

This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.

@github-actions github-actions bot added the stale label Oct 9, 2023
@jooola jooola added pinned and removed stale labels Oct 9, 2023
@jooola jooola added the bug Something isn't working label Feb 5, 2024
@jooola
Copy link
Collaborator

jooola commented Feb 9, 2024

@s4ke The load balancer service module does indeed not validate the arguments correclty. If you define health check you must define all the required arguments.

You can enable the verbose mode to see the error message from the API, telling you what fields are missing or invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinned
Projects
None yet
Development

No branches or pull requests

2 participants