diff --git a/README.md b/README.md
index f1a2a268..673e8117 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi
# Demo site
[Demo site](https://demo.haproxy-wi.org) Login/password: admin/admin. Server resets every hour.
-![alt text](image/haproxy-wi-config-show.jpeg "Show config page")
+![alt text](image/haproxy-wi-config-show.png "Show config page")
# Features:
1. Configure HAProxy In a jiffy with haproxy-wi
@@ -20,17 +20,17 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi
3. Enable/disable servers through stats page without rebooting HAProxy
4. View/Analyse HAproxy logs straight from the haproxy-wi web interface
5. Create and visualise the HAproxy workflow from Web Ui.
-6. Push Your changes to your HAproxy servers with a single click through web interface.
-7. Get info on past changes, Evaluate your config files and restore a previous stable config anytime with a single click straight from Web interface.
+6. Push Your changes to your HAproxy servers with a single click through web interface
+7. Get info on past changes, Evaluate your config files and restore a previous stable config anytime with a single click straight from Web interface
8. Add/Edit Frontend or backend servers via web interface with a click of a button.
-9. Edit config of HAproxy and push changes to All Master/Slave server with a single click.
+9. Edit config of HAProxy and push changes to All Master/Slave server with a single click
10. Add Multiple server to ensure Config Sync between servers.
11. Auto management of ports assigned to Fronted.
12. Evaluate the changes of recent configs pushed to HAproxy instances straight from web ui
-13. Multiple User Roles support for privileged based Viewing and editing of Config.
+13. Multiple User Roles support for privileged based Viewing and editing of Config
14. Create Groups and add /remove servers to ensure proper identification for your HAproxy Clusters
-15. Send notifications to telegram directly from haproxy-wi.
-16. HAProxy-WI supports high Availability to ensure uptime to all Master slave servers configured.
+15. Send notifications to telegram directly from HAProxy-WI
+16. HAProxy-WI supports high Availability to ensure uptime to all Master slave servers configured
17. SSL certificate support.
18. SSH Key support for managing multiple HAproxy Servers straight from haproxy-wi
19. SYN flood protect
@@ -44,6 +44,7 @@ Web interface(user-friendly web GUI, alerting, monitoring and secure) for managi
27. Ability to hide parts of the config with tags for users with "guest" role: "HideBlockStart" and "HideBlockEnd"
28. Mobile-ready desing
29. REST API
+30. Installation and Upgrading HAProxy service via HAProxy-WI
![alt text](image/haproxy-wi-metrics.png "Merics")
@@ -73,6 +74,7 @@ $ chown -R apache:apache haproxy-wi/
Or if use Debian/Ubuntu:
$ sudo apt-get install git net-tools lshw dos2unix apache2 gcc netcat python3.5 python3.5-mod_wsgi mod_ssl python3-pip g++ freetype2-demos libatlas-base-dev openldap-dev libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev python3-dev libssl-dev ansible -y
+$ git clone https://github.com/Aidaho12/haproxy-wi.git /var/www/haproxy-wi
$ chown -R www-data:www-data haproxy-wi/
Both
diff --git a/app/create_db.py b/app/create_db.py
index a3a8b171..7d4af3f5 100644
--- a/app/create_db.py
+++ b/app/create_db.py
@@ -438,7 +438,7 @@ def update_db_v_3_5_3(**kwargs):
def update_ver(**kwargs):
con, cur = get_cur()
- sql = """update version set version = '3.7.4'; """
+ sql = """update version set version = '3.8'; """
try:
cur.execute(sql)
con.commit()
diff --git a/app/options.py b/app/options.py
index 9f4a525d..322e1601 100644
--- a/app/options.py
+++ b/app/options.py
@@ -614,10 +614,14 @@ if form.getvalue('master'):
else:
for l in output:
if "msg" in l or "FAILED" in l:
- l = l.split(':')[1]
- l = l.split('"')[1]
- print(l+"
")
- break
+ try:
+ l = l.split(':')[1]
+ l = l.split('"')[1]
+ print(l+"
")
+ break
+ except:
+ print(output)
+ break
else:
print('success: Master Keepalived was installed
')
@@ -639,10 +643,14 @@ if form.getvalue('master'):
else:
for l in output:
if "msg" in l or "FAILED" in l:
- l = l.split(':')[1]
- l = l.split('"')[1]
- print(l+"
")
- break
+ try:
+ l = l.split(':')[1]
+ l = l.split('"')[1]
+ print(l+"
")
+ break
+ except:
+ print(output)
+ break
else:
print('success: Slave Keepalived was installed
')
@@ -686,10 +694,14 @@ if form.getvalue('masteradd'):
else:
for l in output:
if "msg" in l or "FAILED" in l:
- l = l.split(':')[1]
- l = l.split('"')[1]
- print(l+"
")
- break
+ try:
+ l = l.split(':')[1]
+ l = l.split('"')[1]
+ print(l+"
")
+ break
+ except:
+ print(output)
+ break
else:
print('success: Master VRRP address was added
')
@@ -712,10 +724,14 @@ if form.getvalue('masteradd'):
else:
for l in output:
if "msg" in l or "FAILED" in l:
- l = l.split(':')[1]
- l = l.split('"')[1]
- print(l+"
")
- break
+ try:
+ l = l.split(':')[1]
+ l = l.split('"')[1]
+ print(l+"
")
+ break
+ except:
+ print(output)
+ break
else:
print('success: Slave VRRP address was added
')
diff --git a/app/scripts/ansible/roles/haproxy/tasks/main.yml b/app/scripts/ansible/roles/haproxy/tasks/main.yml
index df446b62..0f5be086 100644
--- a/app/scripts/ansible/roles/haproxy/tasks/main.yml
+++ b/app/scripts/ansible/roles/haproxy/tasks/main.yml
@@ -1,19 +1,9 @@
---
-- name: check if HAProxy is installed
- yum:
- list=haproxy
- register: is_installed
- when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS')
+- name: check if HAProxy is installed Ubuntu
+ package_facts:
+ manager: "auto"
+
-- name: HAProxy has already installed
- debug:
- msg: "HAProxy has already installed"
- when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and is_installed.results|selectattr("yumstate", "match", "installed")|list|length != 0
-
-- name: Exiting
- meta: end_play
- when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and is_installed.results|selectattr("yumstate", "match", "installed")|list|length != 0
-
- name: install HAProxy {{HAPVER}}
yum:
name:
@@ -69,15 +59,41 @@
https_proxy: "{{PROXY}}"
+- name: Change wrong HAProxy service file
+ template:
+ src: haproxy.service.j2
+ dest: /usr/lib/systemd/system/haproxy.service
+ mode: 0644
+ when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and haproxy_from_wi is defined
+
+
+- name: Enable and start service HAProxy
+ systemd:
+ name: haproxy
+ daemon_reload: yes
+ state: started
+ enabled: yes
+ force: no
+ ignore_errors: yes
+ when: "'haproxy' in ansible_facts.packages"
+
+
+- name: Exiting
+ meta: end_play
+ when: "'haproxy' in ansible_facts.packages"
+
+
- name: Get HAProxy version.
command: haproxy -v
register: haproxy_version_result
changed_when: false
check_mode: false
+
- name: Set HAProxy version.
set_fact:
haproxy_version: "{{ '1.5' if '1.5.' in haproxy_version_result.stdout else '1.6' }}"
+
- name: Copy HAProxy configuration in place.
template:
@@ -88,14 +104,6 @@
notify: restart haproxy
-- name: Change wrong HAProxy service file
- template:
- src: haproxy.service.j2
- dest: /usr/lib/systemd/system/haproxy.service
- mode: 0644
- when: haproxy_from_wi is defined
-
-
- name: Enable and start service HAProxy
systemd:
name: haproxy
@@ -105,7 +113,8 @@
force: no
ignore_errors: yes
+
- name: Add syn_flood tasks
include: syn_flood.yml
when: (SYN_FLOOD is defined) and (SYN_FLOOD|length > 0)
-
+
\ No newline at end of file
diff --git a/app/scripts/ansible/roles/keepalived/tasks/install.yml b/app/scripts/ansible/roles/keepalived/tasks/install.yml
index d4cb1cf3..4913d6a4 100644
--- a/app/scripts/ansible/roles/keepalived/tasks/install.yml
+++ b/app/scripts/ansible/roles/keepalived/tasks/install.yml
@@ -1,18 +1,17 @@
---
- name: check if Keepalived is installed
- yum:
- list=keepalived
- register: is_installed
- when: (ansible_facts['os_family'] == "RedHat") or (ansible_facts['os_family'] == 'CentOS')
+ package_facts:
+ manager: "auto"
+
- name: Keepalived has already installed
debug:
msg: "Keepalived has already installed"
- when: is_installed.results|selectattr("yumstate", "match", "installed")|list|length != 0
+ when: "'keepalived' in ansible_facts.packages"
- name: Exiting
meta: end_play
- when: (ansible_facts['os_family'] == "RedHat") or (ansible_facts['os_family'] == 'CentOS') and is_installed.results|selectattr("yumstate", "match", "installed")|list|length != 0
+ when: "'keepalived' in ansible_facts.packages"
- name: install the latest version of Keepalived
@@ -65,4 +64,4 @@
- name: Add syn_flood tasks
include: ../../haproxy/tasks/syn_flood.yml
- when: (SYN_FLOOD is defined) and (SYN_FLOOD|length > 0)
+ when: (SYN_FLOOD is defined) and (SYN_FLOOD|length > 0)
\ No newline at end of file
diff --git a/app/templates/servers.html b/app/templates/servers.html
index 0e0f1edf..d685a44e 100644
--- a/app/templates/servers.html
+++ b/app/templates/servers.html
@@ -273,16 +273,19 @@
Version | +Current version | +Available Versions | Server | SYN flood protect | |
+ | {% set values = dict() %} - {% set values = {'2.0.5-1':'2.0.5-1','2.0.6-1':'2.0.6-1', '2.0.7-1':'2.0.7-1'} %} - {{ select('hapver', values=values, selected='2.0.7-1', required='required') }} + {% set values = {'2.0.5-1':'2.0.5-1','2.0.6-1':'2.0.6-1', '2.0.7-1':'2.0.7-1', '2.0.9-1':'2.0.9-1'} %} + {{ select('hapver', values=values, selected='2.0.9-1', required='required') }} |