增加支持离线安装haproxy

pull/641/head
gjmzj 2019-06-28 19:36:53 +08:00
parent 40c6ade024
commit b4df5ff604
4 changed files with 36 additions and 1 deletions

View File

@ -42,3 +42,6 @@ KUBE_APISERVER: "{%- if inventory_hostname in groups['kube-master'] -%} \
# 增加/删除 master 节点时node 节点需要重新配置 haproxy 等 # 增加/删除 master 节点时node 节点需要重新配置 haproxy 等
MASTER_CHG: "no" MASTER_CHG: "no"
# 离线安装 haproxy (offline|online)
INSTALL_SOURCE: "offline"

View File

@ -6,6 +6,11 @@
- name: 安装 haproxy - name: 安装 haproxy
package: name=haproxy state=present package: name=haproxy state=present
when: 'INSTALL_SOURCE != "offline"'
# 离线安装 haproxy
- import_tasks: offline.yml
when: 'INSTALL_SOURCE == "offline"'
- name: 创建haproxy配置目录 - name: 创建haproxy配置目录
file: name=/etc/haproxy state=directory file: name=/etc/haproxy state=directory

View File

@ -0,0 +1,27 @@
# 离线安装基础系统包
- 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"'

View File

@ -21,7 +21,7 @@
- name: 安装 basic_centos7 离线包 - name: 安装 basic_centos7 离线包
shell: 'cd /opt/kube/packages/basic && tar zxf basic_centos7.tar.gz && \ shell: 'cd /opt/kube/packages/basic && tar zxf basic_centos7.tar.gz && \
basic -Uvh --nodeps *.rpm > /tmp/install_basic.log 2>&1' rpm -Uvh --nodeps *.rpm > /tmp/install_basic.log 2>&1'
when: when:
- 'ansible_distribution == "CentOS"' - 'ansible_distribution == "CentOS"'
- 'ansible_distribution_major_version == "7"' - 'ansible_distribution_major_version == "7"'