2022-04-12 16:26:46 +02:00
|
|
|
---
|
|
|
|
- name: "Install haproxy via apt"
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
state: present
|
|
|
|
name:
|
|
|
|
- haproxy
|
|
|
|
|
2022-04-17 12:22:22 +02:00
|
|
|
- name: Copy haproxy configuration
|
|
|
|
copy:
|
|
|
|
src: haproxy.cfg
|
|
|
|
dest: /etc/haproxy/haproxy.cfg
|
|
|
|
mode: 0644
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
|
2022-05-04 14:45:34 +02:00
|
|
|
- name: Enable and stop haproxy
|
2022-04-12 17:33:48 +02:00
|
|
|
service:
|
|
|
|
name: haproxy
|
2022-05-04 14:45:34 +02:00
|
|
|
state: stopped
|
2022-04-12 17:33:48 +02:00
|
|
|
enabled: yes
|
|
|
|
|
2022-04-12 17:13:13 +02:00
|
|
|
- name: "Install certbot via apt"
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
state: present
|
|
|
|
name:
|
|
|
|
- python3-certbot
|
|
|
|
|
2022-04-17 12:22:22 +02:00
|
|
|
- name: Generate certificate for all proxied domains
|
|
|
|
command:
|
2022-05-04 14:45:34 +02:00
|
|
|
cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --standalone -d neko.tormakristof.eu
|
|
|
|
|
|
|
|
- name: Enable and start haproxy
|
|
|
|
service:
|
|
|
|
name: haproxy
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
2022-04-17 12:22:22 +02:00
|
|
|
|
|
|
|
- name: Copy certbot cronjob
|
|
|
|
copy:
|
|
|
|
src: certbot
|
|
|
|
dest: /etc/cron.weekly/certbot
|
|
|
|
mode: 0755
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
|
2022-04-12 16:26:46 +02:00
|
|
|
- name: Reset ufw rules to default
|
|
|
|
community.general.ufw:
|
|
|
|
state: reset
|
|
|
|
|
2022-04-12 16:49:59 +02:00
|
|
|
- name: Enable ufw
|
|
|
|
community.general.ufw:
|
|
|
|
state: enabled
|
2022-04-17 12:22:22 +02:00
|
|
|
|
2022-05-29 15:15:02 +02:00
|
|
|
- name: "Install haproxy exporter"
|
2022-04-17 12:22:22 +02:00
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
state: present
|
|
|
|
name:
|
2022-05-29 15:15:02 +02:00
|
|
|
- prometheus-haproxy-exporter
|
2022-05-29 21:28:56 +02:00
|
|
|
|
|
|
|
- name: Allow node-exporter via ufw
|
|
|
|
community.general.ufw:
|
|
|
|
rule: allow
|
|
|
|
port: 9100
|
|
|
|
proto: tcp
|
|
|
|
src: 192.168.69.0/24
|
2022-04-16 19:55:29 +02:00
|
|
|
...
|