Update to 2022-08-19 16:00

This commit is contained in:
Daniel Berteaud
2022-08-19 16:00:17 +02:00
parent 6ebee1169f
commit f17ab3267b
50 changed files with 516 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
# Port on which the prometheus exporter will listen
drbd_reactor_prom_port: 9942
# List of IP/CIDR for which the prometheus port will be opened
drbd_reactor_prom_src_ip: []

View File

@@ -0,0 +1,5 @@
---
- name: restart drbd-reactor
service: name=drbd-reactor state=restarted
when: not drbd_reactor_started.changed

View File

@@ -0,0 +1,4 @@
---
dependencies:
- role: drbd

View File

@@ -0,0 +1,6 @@
---
- name: Deploy DRBD Reactor configuration
template: src=drbd-reactor.toml.j2 dest=/etc/drbd-reactor.toml
notify: restart drbd-reactor
tags: drbd

View File

@@ -0,0 +1,11 @@
---
# Load distribution specific variables
- include_vars: "{{ item }}"
with_first_found:
- "{{ role_path }}/vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ role_path }}/vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ role_path }}/vars/{{ ansible_distribution }}.yml"
- "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
tags: drbd

View File

@@ -0,0 +1,18 @@
---
- name: Install packages
package: name={{ drbd_reactor_packages }}
tags: drbd
- name: Install drbd-reactor-reload units
template: src=drbd-reactor-reload.{{ item }}.j2 dest=/etc/systemd/system/drbd-reactor-reload.{{ item }}
loop:
- path
- service
register: drbd_reactor_reload_unit
tags: drbd
- name: Reload systemd
systemd: daemon_realod=True
when: drbd_reactor_reload_unit.changed
tags: drbd

View File

@@ -0,0 +1,8 @@
---
- name: Handle prometheus port ports
iptables_raw:
name: drbd_reactor_prom_port
state: "{{ (drbd_reactor_prom_src_ip | length > 0) | ternary('present','absent') }}"
rules: "-A INPUT -m state --state NEW -p tcp --dport {{ drbd_reactor_prom_port }} -s {{ drbd_reactor_prom_src_ip | join(',') }} -j ACCEPT"
tags: firewall,drbd

View File

@@ -0,0 +1,17 @@
---
- include_tasks: facts.yml
tags: always
- include_tasks: install.yml
tags: always
- include_tasks: conf.yml
tags: always
- include_tasks: iptables.yml
when: iptables_manage | default(True)
tags: always
- include_tasks: services.yml
tags: always

View File

@@ -0,0 +1,10 @@
---
- name: Start and enable the service
service: name=drbd-reactor state=started enabled=True
register: drbd_reactor_started
tags: drbd
- name: Start drbd-reactor-reload
systemd: name=drbd-reactor-reload.path state=started enabled=True
tags: drbd

View File

@@ -0,0 +1,8 @@
[Unit]
Description=Reload drbd-reactor on plugin changes
[Path]
PathChanged=/etc/drbd-reactor.d
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
[Unit]
Description=Reload drbd-reactor on plugin changes
After=drbd-reactor.service
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl reload drbd-reactor.service
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,9 @@
snippets = "/etc/drbd-reactor.d"
statistics-poll-interval = 60
[[log]]
level = "info"
[[promotheus]]
enums = false
address = "0.0.0.0:{{ drbd_reactor_prom_port }}"

View File

@@ -0,0 +1,4 @@
---
drbd_reactor_packages:
- drbd-reactor