Changelog: https://roxy-wi.org/changelog.py#6
pull/321/head
Pavel Loginov 2022-04-19 16:40:28 +03:00
parent 46cb2910eb
commit 3562e8a4f3
7 changed files with 12 additions and 10 deletions

View File

@ -121,7 +121,7 @@ def default_values():
{'param': 'apache_dir', 'value': '/etc/httpd/', 'section': 'apache',
'desc': 'Path to the Apache directory with config files', 'group': '1'},
{'param': 'apache_config_path', 'value': '/etc/httpd/conf/httpd.conf', 'section': 'apache',
'desc': 'Path to the main Nginx configuration file', 'group': '1'},
'desc': 'Path to the main Apache configuration file', 'group': '1'},
{'param': 'apache_container_name', 'value': 'apache', 'section': 'apache',
'desc': 'Docker container name for Apache service', 'group': '1'},
]

View File

@ -1018,7 +1018,7 @@ def upload_and_restart(server_ip, cfg, **kwargs):
if is_docker == '1':
check_config = "sudo docker exec -it " + container_name + " haproxy -q -c -f " + tmp_file
else:
check_config = "sudo " + service_name + " -q -c -f " + tmp_file
check_config = "sudo " + service_name + " -c -f " + tmp_file
move_config = " && sudo mv -f " + tmp_file + " " + config_path
if action == "test":

View File

@ -1,2 +1,3 @@
---
MASTER: MASTER
MASTER: MASTER
router_id: 1

View File

@ -1,7 +1,7 @@
vrrp_instance VI_{{IP}} {
state {{MASTER}}
interface {{ETH}}
virtual_router_id {{ range(2, 255) | random }}
virtual_router_id {{ router_id }}
priority {% if RETURN_TO_MASTER == 1 and MASTER == 'MASTER' %}152{% elif MASTER == 'MASTER' and RETURN_TO_MASTER == 0 %}102{% else %}101{%endif%}
track_script {

View File

@ -3,14 +3,14 @@ global_defs {
}
#health-check for keepalive
vrrp_script chk_haproxy {
script "/usr/bin/pgrep -f 'haproxy '"
script "killall -0 haproxy"
interval 2
weight 3
}
vrrp_instance VI_1 {
state {{MASTER}}
interface {{ETH}}
virtual_router_id 1
virtual_router_id {{router_id}}
priority {% if RETURN_TO_MASTER == '1' and MASTER == 'MASTER' %}152{% elif MASTER == 'MASTER' and RETURN_TO_MASTER == '0' %}102{% else %}101{%endif%}
#check if we are still running

View File

@ -31,16 +31,17 @@ export COMMAND_WARNINGS=False
PWD=`pwd`
PWD=$PWD/scripts/ansible/
echo "$HOST ansible_port=$SSH_PORT" > $PWD/$HOST
router_id=`echo $((1 + $RANDOM % 255))`
if [[ $KEY == "" ]]; then
ansible-playbook $PWD/roles/keepalived.yml -e "ansible_user=$USER ansible_ssh_pass='$PASS' variable_host=$HOST SYN_FLOOD=$SYN_FLOOD PROXY=$PROXY MASTER=$MASTER ETH=$ETH IP=$IP RESTART=$RESTART RETURN_TO_MASTER=$RETURN_TO_MASTER ADD_VRRP=$ADD_VRRP SSH_PORT=$SSH_PORT" -i $PWD/$HOST
ansible-playbook $PWD/roles/keepalived.yml -e "ansible_user=$USER ansible_ssh_pass='$PASS' variable_host=$HOST SYN_FLOOD=$SYN_FLOOD PROXY=$PROXY MASTER=$MASTER ETH=$ETH IP=$IP RESTART=$RESTART RETURN_TO_MASTER=$RETURN_TO_MASTER ADD_VRRP=$ADD_VRRP router_id=$router_id SSH_PORT=$SSH_PORT" -i $PWD/$HOST
else
ansible-playbook $PWD/roles/keepalived.yml --key-file $KEY -e "ansible_user=$USER variable_host=$HOST SYN_FLOOD=$SYN_FLOOD PROXY=$PROXY MASTER=$MASTER ETH=$ETH IP=$IP RESTART=$RESTART RETURN_TO_MASTER=$RETURN_TO_MASTER ADD_VRRP=$ADD_VRRP SSH_PORT=$SSH_PORT" -i $PWD/$HOST
ansible-playbook $PWD/roles/keepalived.yml --key-file $KEY -e "ansible_user=$USER variable_host=$HOST SYN_FLOOD=$SYN_FLOOD PROXY=$PROXY MASTER=$MASTER ETH=$ETH IP=$IP RESTART=$RESTART RETURN_TO_MASTER=$RETURN_TO_MASTER ADD_VRRP=$ADD_VRRP router_id=$router_id SSH_PORT=$SSH_PORT" -i $PWD/$HOST
fi
if [ $? -gt 0 ]
then
echo "error: Can't install keepalived service <br /><br />"
echo "error: Can't install keepalived service <br />"
exit 1
fi
rm -f $PWD/$HOST

View File

@ -204,7 +204,7 @@ def add_setting_for_new_group(group_id):
{'param': 'apache_dir', 'value': '/etc/httpd/', 'section': 'apache',
'desc': 'Path to the Apache directory with config files', 'group': group_id},
{'param': 'apache_config_path', 'value': '/etc/httpd/conf/httpd.conf', 'section': 'apache',
'desc': 'Path to the main Nginx configuration file', 'group': group_id},
'desc': 'Path to the main Apache configuration file', 'group': group_id},
{'param': 'apache_container_name', 'value': 'apache', 'section': 'apache',
'desc': 'Docker container name for Apache service', 'group': group_id},
]