diff options
Diffstat (limited to 'deploy/adapters/ansible/roles/ha')
-rw-r--r-- | deploy/adapters/ansible/roles/ha/files/galera_chk | 10 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ha/files/mysqlchk | 15 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ha/handlers/main.yml | 17 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ha/tasks/main.yml | 96 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ha/templates/haproxy.cfg | 227 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ha/templates/keepalived.conf | 47 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ha/vars/Debian.yml | 11 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ha/vars/RedHat.yml | 11 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ha/vars/main.yml | 18 |
9 files changed, 0 insertions, 452 deletions
diff --git a/deploy/adapters/ansible/roles/ha/files/galera_chk b/deploy/adapters/ansible/roles/ha/files/galera_chk deleted file mode 100644 index 9fd165c0..00000000 --- a/deploy/adapters/ansible/roles/ha/files/galera_chk +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -code=`mysql -uroot -e "show status" | awk '/Threads_running/{print $2}'` - -if [ "$code"=="1" ] -then - echo "HTTP/1.1 200 OK\r\n" -else - echo "HTTP/1.1 503 Service Unavailable\r\n" -fi diff --git a/deploy/adapters/ansible/roles/ha/files/mysqlchk b/deploy/adapters/ansible/roles/ha/files/mysqlchk deleted file mode 100644 index 7c5eaad5..00000000 --- a/deploy/adapters/ansible/roles/ha/files/mysqlchk +++ /dev/null @@ -1,15 +0,0 @@ -# default: off -# description: An xinetd internal service which echo's characters back to -# clients. -# This is the tcp version. -service mysqlchk -{ - disable = no - flags = REUSE - socket_type = stream - protocol = tcp - user = root - wait = no - server = /usr/local/bin/galera_chk - port = 9200 -} diff --git a/deploy/adapters/ansible/roles/ha/handlers/main.yml b/deploy/adapters/ansible/roles/ha/handlers/main.yml deleted file mode 100644 index 34d7a578..00000000 --- a/deploy/adapters/ansible/roles/ha/handlers/main.yml +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: restart haproxy - service: name=haproxy state=restarted enabled=yes - -- name: restart xinetd - service: name=xinetd state=restarted enabled=yes - -- name: restart keepalived - service: name=keepalived state=restarted enabled=yes diff --git a/deploy/adapters/ansible/roles/ha/tasks/main.yml b/deploy/adapters/ansible/roles/ha/tasks/main.yml deleted file mode 100644 index e2f172e7..00000000 --- a/deploy/adapters/ansible/roles/ha/tasks/main.yml +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- include_vars: "{{ ansible_os_family }}.yml" - -- name: install keepalived xinet haproxy - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: "{{ packages | union(packages_noarch) }}" - -- name: generate ha service list - lineinfile: dest=/opt/service create=yes line='{{ item }}' - with_items: "{{ services | union(services_noarch) }}" - -- name: install pexpect - pip: name=pexpect state=present extra_args='--pre' - -- name: activate ip_nonlocal_bind - sysctl: name=net.ipv4.ip_nonlocal_bind value=1 - state=present reload=yes - -- name: set net.ipv4.tcp_keepalive_intvl - sysctl: name=net.ipv4.tcp_keepalive_intvl value=1 - state=present reload=yes - -- name: set net.ipv4.tcp_keepalive_probes - sysctl: name=net.ipv4.tcp_keepalive_probes value=5 - state=present reload=yes - -- name: set net.ipv4.tcp_keepalive_time - sysctl: name=net.ipv4.tcp_keepalive_time value=5 - state=present reload=yes - -- name: update haproxy cfg - template: src=haproxy.cfg dest=/etc/haproxy/haproxy.cfg - notify: restart haproxy - -- name: set haproxy enable flag - lineinfile: dest=/etc/default/haproxy state=present - regexp="ENABLED=*" - line="ENABLED=1" - notify: restart haproxy - when: ansible_os_family == "Debian" - -- name: set haproxy log - lineinfile: dest=/etc/rsyslog.conf state=present - regexp="local0.* /var/log/haproxy.log" - line="local0.* /var/log/haproxy.log" - -- name: set rsyslog udp module - lineinfile: dest=/etc/rsyslog.conf state=present - regexp="^#$ModLoad imudp" - line="$ModLoad imudp" - -- name: set rsyslog udp port - lineinfile: dest=/etc/rsyslog.conf state=present - regexp="^#$UDPServerRun 514" - line="$UDPServerRun 514" - -- name: copy galera_chk file - copy: src=galera_chk dest=/usr/local/bin/galera_chk mode=0777 - -- name: add network service - lineinfile: dest=/etc/services state=present - line="mysqlchk 9200/tcp" - insertafter="Local services" - notify: restart xinetd - -- name: copy mysqlchk file - copy: src=mysqlchk dest=/etc/xinetd.d/mysqlchk mode=0777 - notify: restart xinetd - -- name: set keepalived start param - lineinfile: dest=/etc/default/keepalived state=present - regexp="^DAEMON_ARGS=*" - line="DAEMON_ARGS=\"-D -d -S 1\"" - when: ansible_os_family == "Debian" - -- name: set keepalived log - lineinfile: dest=/etc/rsyslog.conf state=present - regexp="local1.* /var/log/keepalived.log" - line="local1.* /var/log/keepalived.log" - -- name: update keepalived info - template: src=keepalived.conf dest=/etc/keepalived/keepalived.conf - notify: restart keepalived - -- name: restart rsyslog - shell: service rsyslog restart - -- meta: flush_handlers diff --git a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg deleted file mode 100644 index 5fbcc9d9..00000000 --- a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg +++ /dev/null @@ -1,227 +0,0 @@ - -global - #chroot /var/run/haproxy - daemon - user haproxy - group haproxy - maxconn 4000 - pidfile /var/run/haproxy/haproxy.pid - #log 127.0.0.1 local0 - tune.bufsize 1000000 - stats socket /var/run/haproxy.sock - stats timeout 2m - -defaults - log global - maxconn 8000 - option redispatch - option dontlognull - option splice-auto - timeout http-request 10s - timeout queue 1m - timeout connect 10s - timeout client 50s - timeout server 50s - timeout check 10s - retries 3 - -listen proxy-mysql - bind {{ internal_vip.ip }}:3306 - option tcpka - option tcplog - balance source -{% for host, ip in haproxy_hosts.items() %} -{% if loop.index == 1 %} - server {{ host }} {{ ip }}:3306 weight 1 check inter 2000 rise 2 fall 5 -{% else %} - server {{ host }} {{ ip }}:3306 weight 1 check inter 2000 rise 2 fall 5 backup -{% endif %} -{% endfor %} - -listen proxy-rabbit - bind {{ internal_vip.ip }}:5672 - bind {{ public_vip.ip }}:5672 - - option tcpka - option tcplog - timeout client 3h - timeout server 3h - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:5672 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-glance_registry_cluster - bind {{ internal_vip.ip }}:9191 - bind {{ public_vip.ip }}:9191 - option tcpka - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:9191 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-glance_api_cluster - bind {{ internal_vip.ip }}:9292 - bind {{ public_vip.ip }}:9292 - option tcpka - option tcplog - option httpchk - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:9292 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-nova-novncproxy - bind {{ internal_vip.ip }}:6080 - bind {{ public_vip.ip }}:6080 - option tcpka - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:6080 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-network - bind {{ internal_vip.ip }}:9696 - bind {{ public_vip.ip }}:9696 - option tcpka - option tcplog - balance source - option httpchk -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:9696 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-volume - bind {{ internal_vip.ip }}:8776 - bind {{ public_vip.ip }}:8776 - option tcpka - option httpchk - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:8776 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-keystone_admin_cluster - bind {{ internal_vip.ip }}:35357 - bind {{ public_vip.ip }}:35357 - option tcpka - option httpchk - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:35357 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-keystone_public_internal_cluster - bind {{ internal_vip.ip }}:5000 - bind {{ public_vip.ip }}:5000 - option tcpka - option httpchk - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:5000 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-nova_compute_api_cluster - bind {{ internal_vip.ip }}:8774 - bind {{ public_vip.ip }}:8774 - mode tcp - option httpchk - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:8774 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-nova_metadata_api_cluster - bind {{ internal_vip.ip }}:8775 - bind {{ public_vip.ip }}:8775 - option tcpka - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:8775 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-cinder_api_cluster - bind {{ internal_vip.ip }}:8776 - bind {{ public_vip.ip }}:8776 - mode tcp - option httpchk - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:8776 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -#listen proxy-swift-proxy -# bind {{ internal_vip.ip }}:8080 -# bind {{ public_vip.ip }}:8080 -# balance source -# option tcpka -# option tcplog -#{% for host,ip in haproxy_hosts.items() %} -# server {{ host }} {{ ip }}:8080 weight 1 check inter 2000 rise 2 fall 5 -#{% endfor %} - -listen proxy-ceilometer_api_cluster - bind {{ internal_vip.ip }}:8777 - bind {{ public_vip.ip }}:8777 - mode tcp - option tcp-check - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:8777 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-aodh_api_cluster - bind {{ internal_vip.ip }}:8042 - bind {{ public_vip.ip }}:8042 - mode tcp - option tcp-check - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:8042 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-congress_api_cluster - bind {{ internal_vip.ip }}:1789 - bind {{ public_vip.ip }}:1789 - mode tcp - option tcp-check - option tcplog - balance source -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:1789 weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen proxy-dashboarad - bind {{ public_vip.ip }}:80 - mode http - balance source - capture cookie vgnvisitor= len 32 - cookie SERVERID insert indirect nocache - option forwardfor - option httpchk - option httpclose - rspidel ^Set-cookie:\ IP= -{% for host,ip in haproxy_hosts.items() %} - server {{ host }} {{ ip }}:80 cookie {{ host }} weight 1 check inter 2000 rise 2 fall 5 -{% endfor %} - -listen stats - mode http - bind 0.0.0.0:9999 - stats enable - stats refresh 30s - stats uri / - stats realm Global\ statistics - stats auth admin:admin - - diff --git a/deploy/adapters/ansible/roles/ha/templates/keepalived.conf b/deploy/adapters/ansible/roles/ha/templates/keepalived.conf deleted file mode 100644 index c2af86b0..00000000 --- a/deploy/adapters/ansible/roles/ha/templates/keepalived.conf +++ /dev/null @@ -1,47 +0,0 @@ -global_defs { - router_id {{ inventory_hostname }} -} - -vrrp_sync_group VG1 { - group { - internal_vip - public_vip - } -} - -vrrp_instance internal_vip { - interface {{ internal_vip.interface }} - virtual_router_id {{ vrouter_id_internal }} - state BACKUP - nopreempt - advert_int 1 - priority {{ 50 + (host_index[inventory_hostname] * 50) }} - - authentication { - auth_type PASS - auth_pass 1234 - } - - virtual_ipaddress { - {{ internal_vip.ip }}/{{ internal_vip.netmask }} dev {{ internal_vip.interface }} - } -} - -vrrp_instance public_vip { - interface {{ network_cfg.public_vip.interface }} - virtual_router_id {{ vrouter_id_public }} - state BACKUP - nopreempt - advert_int 1 - priority {{ 50 + (host_index[inventory_hostname] * 50) }} - - authentication { - auth_type PASS - auth_pass 4321 - } - - virtual_ipaddress { - {{ network_cfg.public_vip.ip }}/{{ network_cfg.public_vip.netmask }} dev {{ network_cfg.public_vip.interface }} - } - -} diff --git a/deploy/adapters/ansible/roles/ha/vars/Debian.yml b/deploy/adapters/ansible/roles/ha/vars/Debian.yml deleted file mode 100644 index b9f46bdf..00000000 --- a/deploy/adapters/ansible/roles/ha/vars/Debian.yml +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -services: [] -packages: [] diff --git a/deploy/adapters/ansible/roles/ha/vars/RedHat.yml b/deploy/adapters/ansible/roles/ha/vars/RedHat.yml deleted file mode 100644 index b9f46bdf..00000000 --- a/deploy/adapters/ansible/roles/ha/vars/RedHat.yml +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -services: [] -packages: [] diff --git a/deploy/adapters/ansible/roles/ha/vars/main.yml b/deploy/adapters/ansible/roles/ha/vars/main.yml deleted file mode 100644 index bd739699..00000000 --- a/deploy/adapters/ansible/roles/ha/vars/main.yml +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -packages_noarch: - - keepalived - - xinetd - - haproxy - -services_noarch: - - keepalived - - xinetd - - haproxy |