Skip to content

Commit

Permalink
Revert "chore: HAproxy config is using IPs"
Browse files Browse the repository at this point in the history
This reverts commit eb375ea.
  • Loading branch information
smolin-de committed Jul 25, 2024
1 parent 768cebb commit d58ca09
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion playbooks/create_compute_node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
when: env.bastion.options.loadbalancer.on_bastion
param_haproxy_cmd: add
param_haproxy_hostname: "{{ day2_compute_node.vm_hostname }}"
param_haproxy_ip: "{{ day2_compute_node.vm_ip }}"

- role: tune_kvm_domain
when: day2_compute_node.vm_name[0] is defined
Expand Down
1 change: 0 additions & 1 deletion playbooks/delete_compute_node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
when: env.bastion.options.loadbalancer.on_bastion
param_haproxy_cmd: delete
param_haproxy_hostname: "{{ day2_compute_node.vm_hostname }}"
param_haproxy_ip: "{{ day2_compute_node.vm_ip }}"

- role: dns_update
when: env.bastion.options.dns is defined and env.bastion.options.dns
Expand Down
4 changes: 2 additions & 2 deletions roles/haproxy/templates/haproxy.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ listen api-server-6443
mode tcp
balance roundrobin
#6443 section
server {{ env.cluster.nodes.bootstrap.hostname }} {{ env.cluster.nodes.bootstrap.ip }}:6443 weight 1 verify none check check-ssl inter 10s fall 2 rise 3 backup
server {{ env.cluster.nodes.bootstrap.hostname }} {{ env.cluster.nodes.bootstrap.hostname }}.{{ env.cluster.networking.metadata_name }}.{{ env.cluster.networking.base_domain }}:6443 weight 1 verify none check check-ssl inter 10s fall 2 rise 3 backup
listen machine-config-server-22623
bind *:22623
mode tcp
balance roundrobin
#22623 section
server {{ env.cluster.nodes.bootstrap.hostname }} {{ env.cluster.nodes.bootstrap.ip }}:22623 check inter 1s backup
server {{ env.cluster.nodes.bootstrap.hostname }} {{ env.cluster.nodes.bootstrap.hostname }}.{{ env.cluster.networking.metadata_name }}.{{ env.cluster.networking.base_domain }}:22623 check inter 1s backup
listen ingress-router-443
bind *:443
mode tcp
Expand Down
4 changes: 2 additions & 2 deletions roles/haproxy_update/tasks/add.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
ansible.builtin.lineinfile:
path: /etc/haproxy/haproxy.cfg
insertafter: "#80 section"
line: " server {{ param_haproxy_hostname }} {{ param_haproxy_ip }}:80 check inter 1s"
line: " server {{ param_haproxy_hostname }} {{ param_haproxy_hostname }}.{{ env.cluster.networking.metadata_name }}.{{ env.cluster.networking.base_domain }}:80 check inter 1s"
state: present

- name: Add haproxy for 443 port
ansible.builtin.lineinfile:
path: /etc/haproxy/haproxy.cfg
insertafter: "#443 section"
line: " server {{ param_haproxy_hostname }} {{ param_haproxy_ip }}:443 check inter 1s"
line: " server {{ param_haproxy_hostname }} {{ param_haproxy_hostname }}.{{ env.cluster.networking.metadata_name }}.{{ env.cluster.networking.base_domain }}:443 check inter 1s"
state: present
4 changes: 2 additions & 2 deletions roles/haproxy_update/tasks/delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
ansible.builtin.lineinfile:
path: /etc/haproxy/haproxy.cfg
state: absent
regex: "{{ param_haproxy_ip }}:80 check"
regex: "{{ param_haproxy_hostname }}.{{ env.cluster.networking.metadata_name }}.{{ env.cluster.networking.base_domain }}:80 check"

- name: Delete haproxy port 443
ansible.builtin.lineinfile:
path: /etc/haproxy/haproxy.cfg
state: absent
regex: "{{ param_haproxy_ip }}:443 check"
regex: "{{ param_haproxy_hostname }}.{{ env.cluster.networking.metadata_name }}.{{ env.cluster.networking.base_domain }}:443 check"
1 change: 0 additions & 1 deletion roles/haproxy_update/vars/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
param_haproxy_cmd: add
param_haproxy_hostname:
param_haproxy_ip:

0 comments on commit d58ca09

Please sign in to comment.