-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure-rhel-router.yaml
executable file
·148 lines (122 loc) · 4.34 KB
/
configure-rhel-router.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/env ansible-playbook
---
- name: Start hcloud_instance
hosts: routers
gather_facts: yes
tasks:
- name: Copy nmconnect
copy:
dest: "/etc/NetworkManager/system-connections/{{ network_primary_interface }}.{{ network_vlanid }}.nmconnection"
owner: root
group: root
mode: 0600
content: |
[connection]
id=vlan{{ network_vlanid }}
type=vlan
interface-name={{ network_primary_interface }}.{{ network_vlanid }}
permissions=
zone=internal
[ethernet]
mac-address-blacklist=
mtu=1400
[vlan]
egress-priority-map=
flags=1
id={{ network_vlanid }}
ingress-priority-map=
parent={{ network_primary_interface }}
[ipv4]
address1={{ internal_ip }}/24
dns-search=
method=manual
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=disabled
[proxy]
# - include_role:
# name: hetzner-baremetal-openshift
# tasks_from: create-dns-lb.yaml
- name: install haproxy
package:
name:
- haproxy
# To get stats:
# echo "show stat" | nc -U /var/lib/haproxy/stats | cut -d "," -f 1,2,18,57| column -s, -t;
- nc
state: present
- name: Configure haproxy
copy:
backup: yes
dest: /etc/haproxy/haproxy.cfg
content: |
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
#option httplog
option dontlognull
#option http-server-close
#option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
listen machine-config-server
bind {{ internal_ip }}:22623
mode tcp
{% for host in groups['masters'] -%}
server {{ host }} {{ hostvars[host].internal_ip }}:22623 check
{% endfor -%}
{% for host in groups['bootstrap'] -%}
server {{ host }} {{ hostvars[host].internal_ip }}:22623 check
{% endfor -%}
listen api
bind {{ internal_ip }}:6443
bind {{ hetzner_ip }}:6443
mode tcp
{% for host in groups['masters'] -%}
server {{ host }} {{ hostvars[host].internal_ip }}:6443 check
{% endfor -%}
{% for host in groups['bootstrap'] -%}
server {{ host }} {{ hostvars[host].internal_ip }}:6443 check
{% endfor -%}
listen ingress-https
bind {{ internal_ip }}:443
bind {{ hetzner_ip }}:443
mode tcp
{% for host in groups['nodes'] -%}
server {{ host }} {{ hostvars[host].internal_ip }}:443 check
{% endfor -%}
listen ingress-http
bind {{ internal_ip }}:80
bind {{ hetzner_ip }}:80
mode tcp
{% for host in groups['nodes'] -%}
server {{ host }} {{ hostvars[host].internal_ip }}:80 check
{% endfor -%}
- name: enable haproxy
systemd:
name: haproxy
enabled: yes
masked: no
state: started