mirror of https://github.com/Aidaho12/haproxy-wi
v7.2.0.0
Additionally, import paths were corrected in the Python file 'app/routes/install/routes.py'. Error handling was improved in the 'install_service' function to return details of any encountered exceptions.pull/375/head
parent
cb03546ca2
commit
8030a69a05
|
@ -3,19 +3,19 @@ from flask_login import login_required
|
||||||
|
|
||||||
from app.routes.install import bp
|
from app.routes.install import bp
|
||||||
from middleware import get_user_params, check_services
|
from middleware import get_user_params, check_services
|
||||||
import modules.db.sql as sql
|
import app.modules.db.sql as sql
|
||||||
import modules.common.common as common
|
import app.modules.common.common as common
|
||||||
import modules.roxywi.auth as roxywi_auth
|
import app.modules.roxywi.auth as roxywi_auth
|
||||||
import modules.server.server as server_mod
|
import app.modules.server.server as server_mod
|
||||||
import modules.service.common as service_common
|
import app.modules.service.common as service_common
|
||||||
import app.modules.service.installation as service_mod
|
import app.modules.service.installation as service_mod
|
||||||
import modules.service.exporter_installation as exp_installation
|
import app.modules.service.exporter_installation as exp_installation
|
||||||
|
|
||||||
|
|
||||||
@bp.before_request
|
@bp.before_request
|
||||||
@login_required
|
@login_required
|
||||||
def before_request():
|
def before_request():
|
||||||
""" Protect all of the admin endpoints. """
|
""" Protect all the admin endpoints. """
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,10 @@ def install_monitoring():
|
||||||
@check_services
|
@check_services
|
||||||
def install_service(service):
|
def install_service(service):
|
||||||
json_data = request.form.get('jsonData')
|
json_data = request.form.get('jsonData')
|
||||||
return service_mod.install_service(service, json_data)
|
try:
|
||||||
|
return service_mod.install_service(service, json_data)
|
||||||
|
except Exception as e:
|
||||||
|
return f'{e}'
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/<service>/version/<server_ip>')
|
@bp.route('/<service>/version/<server_ip>')
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
src: haproxy.service.j2
|
src: haproxy.service.j2
|
||||||
dest: /usr/lib/systemd/system/haproxy.service
|
dest: /usr/lib/systemd/system/haproxy.service
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: ansible_os_family == "RedHat" and haproxy_from_wi is defined
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and haproxy_from_wi is defined
|
||||||
|
|
||||||
- name: test to see if selinux is running
|
- name: test to see if selinux is running
|
||||||
command: getenforce
|
command: getenforce
|
||||||
register: sestatus
|
register: sestatus
|
||||||
when: ansible_os_family == "RedHat"
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS')
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
debugger: never
|
debugger: never
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
debugger: never
|
debugger: never
|
||||||
when:
|
when:
|
||||||
- '"firewalld" in ansible_facts.packages'
|
- '"firewalld" in ansible_facts.packages'
|
||||||
- ansible_os_family == "RedHat"
|
- ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS'
|
||||||
- ansible_facts.services["firewalld.service"]['state'] == "running"
|
- ansible_facts.services["firewalld.service"]['state'] == "running"
|
||||||
with_items: [ "{{ STAT_PORT }}", "{{ SOCK_PORT }}", "10000" ]
|
with_items: [ "{{ STAT_PORT }}", "{{ SOCK_PORT }}", "10000" ]
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
name: epel-release
|
name: epel-release
|
||||||
state: latest
|
state: latest
|
||||||
disable_gpg_check: yes
|
disable_gpg_check: yes
|
||||||
when: ansible_os_family == "RedHat" and HAPVER|length > 0
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and HAPVER|length > 0
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
environment:
|
environment:
|
||||||
http_proxy: "{{PROXY}}"
|
http_proxy: "{{PROXY}}"
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
- name: Set dist short name if EL
|
- name: Set dist short name if EL
|
||||||
set_fact:
|
set_fact:
|
||||||
distr_short_name: "el"
|
distr_short_name: "el"
|
||||||
when: ansible_os_family == "RedHat"
|
when: ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS'
|
||||||
|
|
||||||
- name: Set dist short name if Amazon Linux
|
- name: Set dist short name if Amazon Linux
|
||||||
set_fact:
|
set_fact:
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
- rsyslog
|
- rsyslog
|
||||||
state: present
|
state: present
|
||||||
disable_gpg_check: yes
|
disable_gpg_check: yes
|
||||||
when: ansible_os_family == "RedHat" and HAPVER|length > 0
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and HAPVER|length > 0
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
register: install_result
|
register: install_result
|
||||||
retries: 5
|
retries: 5
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
- rsyslog
|
- rsyslog
|
||||||
- bind-utils
|
- bind-utils
|
||||||
state: present
|
state: present
|
||||||
when: (ansible_os_family == "RedHat") and ("'timed out' in install_result.stderr")
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ("'timed out' in install_result.stderr")
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
register: install_result1
|
register: install_result1
|
||||||
retries: 5
|
retries: 5
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
- name: set_fact from wi
|
- name: set_fact from wi
|
||||||
set_fact:
|
set_fact:
|
||||||
haproxy_from_wi: "yes"
|
haproxy_from_wi: "yes"
|
||||||
when: (ansible_os_family == "RedHat"' or ansible_distribution == 'Amazon') and HAPVER|length > 0
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS' or ansible_distribution == 'Amazon') and HAPVER|length > 0
|
||||||
|
|
||||||
|
|
||||||
- name: install the latest version of HAProxy
|
- name: install the latest version of HAProxy
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
- socat
|
- socat
|
||||||
- rsyslog
|
- rsyslog
|
||||||
state: latest
|
state: latest
|
||||||
when: (ansible_os_family == "RedHat") and (install_result.rc != 0 and install_result1.rc != 0)
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and (install_result.rc != 0 and install_result1.rc != 0)
|
||||||
register: install_result
|
register: install_result
|
||||||
retries: 5
|
retries: 5
|
||||||
until: install_result.rc == 0
|
until: install_result.rc == 0
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
- socat
|
- socat
|
||||||
- rsyslog
|
- rsyslog
|
||||||
state: present
|
state: present
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu'
|
||||||
environment:
|
environment:
|
||||||
http_proxy: "{{PROXY}}"
|
http_proxy: "{{PROXY}}"
|
||||||
https_proxy: "{{PROXY}}"
|
https_proxy: "{{PROXY}}"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
src: /var/www/haproxy-wi/app/scripts/ansible/roles/haproxy/templates/logrotate.conf.j2
|
src: /var/www/haproxy-wi/app/scripts/ansible/roles/haproxy/templates/logrotate.conf.j2
|
||||||
dest: /etc/logrotate.d/haproxy.conf
|
dest: /etc/logrotate.d/haproxy.conf
|
||||||
force: no
|
force: no
|
||||||
when: ansible_os_family == "RedHat"
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS')
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: Installing HAProxy conf for logrotate on Debian
|
- name: Installing HAProxy conf for logrotate on Debian
|
||||||
|
@ -19,5 +19,5 @@
|
||||||
src: /var/www/haproxy-wi/app/scripts/ansible/roles/haproxy/templates/logrotate-debian.conf.j2
|
src: /var/www/haproxy-wi/app/scripts/ansible/roles/haproxy/templates/logrotate-debian.conf.j2
|
||||||
dest: /etc/logrotate.d/haproxy-roxy-wi
|
dest: /etc/logrotate.d/haproxy-roxy-wi
|
||||||
force: no
|
force: no
|
||||||
when: ansible_os_family == "Debian"
|
when: (ansible_facts['os_family'] == "Debian" or ansible_facts['os_family'] == 'Ubuntu')
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
Loading…
Reference in New Issue