mirror of https://github.com/easzlab/kubeasz.git
增加支持离线安装ex-lb
parent
b4df5ff604
commit
657d2c12d8
|
@ -13,3 +13,6 @@ BALANCE_ALG: "roundrobin"
|
||||||
INGRESS_NODEPORT_LB: "yes"
|
INGRESS_NODEPORT_LB: "yes"
|
||||||
# 启用 ingress tls NodePort服务的负载均衡 (yes/no)
|
# 启用 ingress tls NodePort服务的负载均衡 (yes/no)
|
||||||
INGRESS_TLS_NODEPORT_LB: "yes"
|
INGRESS_TLS_NODEPORT_LB: "yes"
|
||||||
|
|
||||||
|
# 离线安装 haproxy+keepalived (offline|online)
|
||||||
|
INSTALL_SOURCE: "offline"
|
||||||
|
|
|
@ -13,15 +13,22 @@
|
||||||
set_fact: LB_IF={{ LB_IF_TMP.stdout }}
|
set_fact: LB_IF={{ LB_IF_TMP.stdout }}
|
||||||
tags: restart_lb
|
tags: restart_lb
|
||||||
|
|
||||||
- name: apt更新缓存刷新
|
- name: 创建相关目录
|
||||||
apt: update_cache=yes cache_valid_time=72000
|
file: name={{ item }} state=directory
|
||||||
when: 'ansible_distribution in ["Ubuntu","Debian"]'
|
with_items:
|
||||||
|
- /etc/haproxy
|
||||||
|
- /etc/keepalived
|
||||||
|
|
||||||
- name: 安装 haproxy
|
- name: 安装 haproxy+keepalived
|
||||||
package: name=haproxy state=present
|
package: name={{ item }} state=present
|
||||||
|
with_items:
|
||||||
|
- haproxy
|
||||||
|
- keepalived
|
||||||
|
when: 'INSTALL_SOURCE != "offline"'
|
||||||
|
|
||||||
- name: 创建haproxy配置目录
|
# 离线安装 haproxy+keepalived
|
||||||
file: name=/etc/haproxy state=directory
|
- import_tasks: offline.yml
|
||||||
|
when: 'INSTALL_SOURCE == "offline"'
|
||||||
|
|
||||||
- name: 修改centos的haproxy.service
|
- name: 修改centos的haproxy.service
|
||||||
template: src=haproxy.service.j2 dest=/usr/lib/systemd/system/haproxy.service
|
template: src=haproxy.service.j2 dest=/usr/lib/systemd/system/haproxy.service
|
||||||
|
@ -32,12 +39,6 @@
|
||||||
template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg
|
template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg
|
||||||
tags: restart_lb
|
tags: restart_lb
|
||||||
|
|
||||||
- name: 安装 keepalived
|
|
||||||
package: name=keepalived state=present
|
|
||||||
|
|
||||||
- name: 创建keepalived配置目录
|
|
||||||
file: name=/etc/keepalived state=directory
|
|
||||||
|
|
||||||
- name: 配置 keepalived 主节点
|
- name: 配置 keepalived 主节点
|
||||||
template: src=keepalived-master.conf.j2 dest=/etc/keepalived/keepalived.conf
|
template: src=keepalived-master.conf.j2 dest=/etc/keepalived/keepalived.conf
|
||||||
when: LB_ROLE == "master"
|
when: LB_ROLE == "master"
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
# 离线安装 haproxy
|
||||||
|
- name: 准备离线安装包目录
|
||||||
|
file: name=/opt/kube/packages/haproxy state=directory
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: 分发 haproxy_xenial 离线包
|
||||||
|
copy:
|
||||||
|
src: "{{ base_dir }}/down/packages/haproxy_xenial.tar.gz"
|
||||||
|
dest: "/opt/kube/packages/haproxy/haproxy_xenial.tar.gz"
|
||||||
|
|
||||||
|
- name: 安装 haproxy_xenial 离线包
|
||||||
|
shell: 'cd /opt/kube/packages/haproxy && tar zxf haproxy_xenial.tar.gz && \
|
||||||
|
dpkg -i *.deb > /tmp/install_haproxy.log 2>&1'
|
||||||
|
when: ansible_distribution_release == "xenial"
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: 分发 haproxy_centos7 离线包
|
||||||
|
copy:
|
||||||
|
src: "{{ base_dir }}/down/packages/haproxy_centos7.tar.gz"
|
||||||
|
dest: "/opt/kube/packages/haproxy/haproxy_centos7.tar.gz"
|
||||||
|
|
||||||
|
- name: 安装 haproxy_centos7 离线包
|
||||||
|
shell: 'cd /opt/kube/packages/haproxy && tar zxf haproxy_centos7.tar.gz && \
|
||||||
|
rpm -Uvh --nodeps *.rpm > /tmp/install_haproxy.log 2>&1'
|
||||||
|
when:
|
||||||
|
- 'ansible_distribution == "CentOS"'
|
||||||
|
- 'ansible_distribution_major_version == "7"'
|
||||||
|
|
||||||
|
# 离线安装 keepalived
|
||||||
|
- name: 准备离线安装包目录
|
||||||
|
file: name=/opt/kube/packages/keepalived state=directory
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: 分发 keepalived_xenial 离线包
|
||||||
|
copy:
|
||||||
|
src: "{{ base_dir }}/down/packages/keepalived_xenial.tar.gz"
|
||||||
|
dest: "/opt/kube/packages/keepalived/keepalived_xenial.tar.gz"
|
||||||
|
|
||||||
|
- name: 安装 keepalived_xenial 离线包
|
||||||
|
shell: 'cd /opt/kube/packages/keepalived && tar zxf keepalived_xenial.tar.gz && \
|
||||||
|
dpkg -i *.deb > /tmp/install_keepalived.log 2>&1'
|
||||||
|
when: ansible_distribution_release == "xenial"
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: 分发 keepalived_centos7 离线包
|
||||||
|
copy:
|
||||||
|
src: "{{ base_dir }}/down/packages/keepalived_centos7.tar.gz"
|
||||||
|
dest: "/opt/kube/packages/keepalived/keepalived_centos7.tar.gz"
|
||||||
|
|
||||||
|
- name: 安装 keepalived_centos7 离线包
|
||||||
|
shell: 'cd /opt/kube/packages/keepalived && tar zxf keepalived_centos7.tar.gz && \
|
||||||
|
rpm -Uvh --nodeps *.rpm > /tmp/install_keepalived.log 2>&1'
|
||||||
|
when:
|
||||||
|
- 'ansible_distribution == "CentOS"'
|
||||||
|
- 'ansible_distribution_major_version == "7"'
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
global
|
global
|
||||||
log /dev/log local1 warning
|
log /dev/log local1 warning
|
||||||
chroot /var/lib/haproxy
|
chroot /var/lib/haproxy
|
||||||
stats socket /run/haproxy/admin.sock mode 660 level admin
|
|
||||||
stats timeout 30s
|
|
||||||
user haproxy
|
user haproxy
|
||||||
group haproxy
|
group haproxy
|
||||||
daemon
|
daemon
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# 离线安装基础系统包
|
# 离线安装 haproxy
|
||||||
- name: 准备离线安装包目录
|
- name: 准备离线安装包目录
|
||||||
file: name=/opt/kube/packages/haproxy state=directory
|
file: name=/opt/kube/packages/haproxy state=directory
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
global
|
global
|
||||||
log /dev/log local1 warning
|
log /dev/log local1 warning
|
||||||
chroot /var/lib/haproxy
|
chroot /var/lib/haproxy
|
||||||
stats socket /run/haproxy/admin.sock mode 660 level admin
|
|
||||||
stats timeout 30s
|
|
||||||
user haproxy
|
user haproxy
|
||||||
group haproxy
|
group haproxy
|
||||||
daemon
|
daemon
|
||||||
|
|
Loading…
Reference in New Issue