mirror of https://github.com/Aidaho12/haproxy-wi
parent
4258623548
commit
76995b3f1f
|
@ -432,7 +432,7 @@ def update_db_v_42(**kwargs):
|
|||
|
||||
def update_ver(**kwargs):
|
||||
con, cur = get_cur()
|
||||
sql = """update version set version = '4.2.1.0'; """
|
||||
sql = """update version set version = '4.2.2.0'; """
|
||||
try:
|
||||
cur.execute(sql)
|
||||
con.commit()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import funct, sql
|
||||
import create_db
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
@ -28,6 +29,10 @@ try:
|
|||
keep_alive, stderr = funct.subprocess_execute(cmd)
|
||||
cmd = "ps ax |grep '(wsgi:api)'|grep -v grep|wc -l"
|
||||
api, stderr = funct.subprocess_execute(cmd)
|
||||
cmd = "ps ax |grep grafana|grep -v grep|wc -l"
|
||||
grafana, stderr = funct.subprocess_execute(cmd)
|
||||
cmd = "ps ax |grep prometheus |grep -v grep|wc -l"
|
||||
prometheus, stderr = funct.subprocess_execute(cmd)
|
||||
except:
|
||||
role = ''
|
||||
user = ''
|
||||
|
@ -40,11 +45,12 @@ except:
|
|||
checker_worker = ''
|
||||
keep_alive = ''
|
||||
api = ''
|
||||
date = ''
|
||||
error = ''
|
||||
grafana = ''
|
||||
prometheus = ''
|
||||
versions = ''
|
||||
haproxy_wi_log = ''
|
||||
servers = ''
|
||||
stderr = ''
|
||||
|
||||
|
||||
template = template.render(h2 = 1,
|
||||
|
@ -61,6 +67,8 @@ template = template.render(h2 = 1,
|
|||
checker_worker = ''.join(checker_worker),
|
||||
keep_alive = ''.join(keep_alive),
|
||||
api = ''.join(api),
|
||||
grafana = ''.join(grafana),
|
||||
prometheus = ''.join(prometheus),
|
||||
haproxy_wi_log_id = funct.haproxy_wi_log(log_id=1, file="haproxy-wi-", with_date=1),
|
||||
metrics_log_id = funct.haproxy_wi_log(log_id=1, file="metrics-", with_date=1),
|
||||
checker_log_id = funct.haproxy_wi_log(log_id=1, file="checker-", with_date=1),
|
||||
|
|
|
@ -6,6 +6,28 @@
|
|||
set_fact:
|
||||
ansible_port: "{{SSH_PORT}}"
|
||||
|
||||
|
||||
- name: Open stat port for firewalld
|
||||
firewalld:
|
||||
port: "9101/tcp"
|
||||
state: enabled
|
||||
permanent: yes
|
||||
immediate: yes
|
||||
ignore_errors: yes
|
||||
no_log: True
|
||||
debugger: never
|
||||
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ansible_facts.services["firewalld.service"]['state'] == "running"
|
||||
|
||||
|
||||
- name: Open stat port for iptables
|
||||
iptables:
|
||||
chain: INPUT
|
||||
destination_port: 9101
|
||||
jump: ACCEPT
|
||||
protocol: tcp
|
||||
ignore_errors: yes
|
||||
|
||||
|
||||
roles:
|
||||
- role: bdellegrazie.haproxy_exporter
|
||||
vars:
|
||||
|
|
|
@ -47,6 +47,23 @@
|
|||
https_proxy: "{{PROXY}}"
|
||||
|
||||
|
||||
- name: Ensure group "keepalived_script" exists
|
||||
group:
|
||||
name: keepalived_script
|
||||
state: present
|
||||
system: yes
|
||||
|
||||
|
||||
- name: Add the user 'keepalived_script'
|
||||
user:
|
||||
name: keepalived_script
|
||||
comment: User for keepalived_script
|
||||
group: keepalived_script
|
||||
shell: /sbin/nologin
|
||||
create_home: no
|
||||
system: yes
|
||||
|
||||
|
||||
- name: Copy keepalived configuration in place.
|
||||
template:
|
||||
src: keepalived.conf.j2
|
||||
|
|
|
@ -3,7 +3,7 @@ global_defs {
|
|||
}
|
||||
#health-check for keepalive
|
||||
vrrp_script chk_haproxy {
|
||||
script "pgrep haproxy"
|
||||
script "/usr/bin/pgrep haproxy"
|
||||
interval 2
|
||||
weight 3
|
||||
}
|
||||
|
|
|
@ -6,25 +6,30 @@
|
|||
set_fact:
|
||||
ansible_port: "{{SSH_PORT}}"
|
||||
|
||||
|
||||
- name: check if Nginx is installed
|
||||
package_facts:
|
||||
manager: "auto"
|
||||
|
||||
|
||||
- name: populate service facts
|
||||
service_facts:
|
||||
|
||||
|
||||
- name: Creates directory
|
||||
file:
|
||||
path: /etc/nginx
|
||||
state: directory
|
||||
when: "'nginx' not in ansible_facts.packages"
|
||||
|
||||
|
||||
- name: Creates directory
|
||||
file:
|
||||
path: /etc/nginx/conf.d
|
||||
state: directory
|
||||
when: "'nginx' not in ansible_facts.packages"
|
||||
|
||||
|
||||
- name: Install passlib
|
||||
package:
|
||||
name: python-passlib
|
||||
|
@ -34,6 +39,7 @@
|
|||
http_proxy: "{{PROXY}}"
|
||||
https_proxy: "{{PROXY}}"
|
||||
|
||||
|
||||
- name: Copy Nginx configuration in place.
|
||||
template:
|
||||
src: ./default.conf.j2
|
||||
|
@ -42,6 +48,7 @@
|
|||
when: "'nginx' not in ansible_facts.packages"
|
||||
ignore_errors: yes
|
||||
|
||||
|
||||
- name: Open stat port for firewalld
|
||||
firewalld:
|
||||
port: "{{ STAT_PORT }}/tcp"
|
||||
|
@ -51,6 +58,17 @@
|
|||
ignore_errors: yes
|
||||
no_log: True
|
||||
debugger: never
|
||||
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ansible_facts.services["firewalld.service"]['state'] == "running"
|
||||
|
||||
|
||||
- name: Open stat port for iptables
|
||||
iptables:
|
||||
chain: INPUT
|
||||
destination_port: "{{ STAT_PORT }}"
|
||||
jump: ACCEPT
|
||||
protocol: tcp
|
||||
ignore_errors: yes
|
||||
|
||||
|
||||
- htpasswd:
|
||||
path: /etc/nginx/status_page_passwdfile
|
||||
|
|
|
@ -6,6 +6,28 @@
|
|||
set_fact:
|
||||
ansible_port: "{{SSH_PORT}}"
|
||||
|
||||
|
||||
- name: Open stat port for firewalld
|
||||
firewalld:
|
||||
port: "9113/tcp"
|
||||
state: enabled
|
||||
permanent: yes
|
||||
immediate: yes
|
||||
ignore_errors: yes
|
||||
no_log: True
|
||||
debugger: never
|
||||
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ansible_facts.services["firewalld.service"]['state'] == "running"
|
||||
|
||||
|
||||
- name: Open stat port for iptables
|
||||
iptables:
|
||||
chain: INPUT
|
||||
destination_port: 9113
|
||||
jump: ACCEPT
|
||||
protocol: tcp
|
||||
ignore_errors: yes
|
||||
|
||||
|
||||
roles:
|
||||
- role: bdellegrazie.nginx_exporter
|
||||
environment:
|
||||
|
|
|
@ -338,7 +338,7 @@
|
|||
{{ input(id, value=telegram.1, style="margin-bottom: 23px;") }}
|
||||
</td>
|
||||
<td>
|
||||
{% set id = 'telegram-token-' + telegram.0|string() %}
|
||||
{% set id = 'telegram-chanel-' + telegram.0|string() %}
|
||||
{{ input(id, value=telegram.2) }}
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
@ -17,8 +17,10 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% if service != 'keepalived' %}
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Show running config" onclick="showConfig()">Open</a>
|
||||
<a class="ui-button ui-widget ui-corner-all" title="View stat" onclick="openStats()">Stat</a>
|
||||
{% endif %}
|
||||
{% if service != 'keepalived' and service != 'nginx'%}
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Show map" onclick="showMap()">Map</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -44,7 +44,7 @@ def main():
|
|||
sys.exit()
|
||||
else:
|
||||
cur_stat_service = "Ok"
|
||||
|
||||
time.sleep(30)
|
||||
|
||||
if __name__ == "__main__":
|
||||
funct.logging("localhost", " Keep alive service is started", keep_alive=1)
|
||||
|
|
Loading…
Reference in New Issue