From 5ec23d69c0ae79460f94df548d66f57f88f86da9 Mon Sep 17 00:00:00 2001 From: gjmzj Date: Tue, 16 Jul 2019 23:26:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81debian9=E7=A6=BB=E7=BA=BF?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=9F=BA=E7=A1=80=E8=BD=AF=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/ex-lb/tasks/offline.yml | 24 ++++++++++++++++++++++++ roles/kube-node/tasks/offline.yml | 12 ++++++++++++ roles/prepare/tasks/offline.yml | 17 +++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/roles/ex-lb/tasks/offline.yml b/roles/ex-lb/tasks/offline.yml index ff3ea36..ab699d6 100644 --- a/roles/ex-lb/tasks/offline.yml +++ b/roles/ex-lb/tasks/offline.yml @@ -40,6 +40,18 @@ - 'ansible_distribution_major_version == "7"' ignore_errors: true +- block: + - name: 分发 haproxy_stretch 离线包 + copy: + src: "{{ base_dir }}/down/packages/haproxy_stretch.tar.gz" + dest: "/opt/kube/packages/haproxy/haproxy_stretch.tar.gz" + + - name: 安装 haproxy_stretch 离线包 + shell: 'cd /opt/kube/packages/haproxy && tar zxf haproxy_stretch.tar.gz && \ + dpkg -i *.deb > /tmp/install_haproxy.log 2>&1' + when: ansible_distribution_release == "stretch" + ignore_errors: true + # 离线安装 keepalived - name: 准备离线安装包目录 file: name=/opt/kube/packages/keepalived state=directory @@ -81,3 +93,15 @@ - 'ansible_distribution == "CentOS"' - 'ansible_distribution_major_version == "7"' ignore_errors: true + +- block: + - name: 分发 keepalived_stretch 离线包 + copy: + src: "{{ base_dir }}/down/packages/keepalived_stretch.tar.gz" + dest: "/opt/kube/packages/keepalived/keepalived_stretch.tar.gz" + + - name: 安装 keepalived_stretch 离线包 + shell: 'cd /opt/kube/packages/keepalived && tar zxf keepalived_stretch.tar.gz && \ + dpkg -i *.deb > /tmp/install_keepalived.log 2>&1' + when: ansible_distribution_release == "stretch" + ignore_errors: true diff --git a/roles/kube-node/tasks/offline.yml b/roles/kube-node/tasks/offline.yml index 27911e9..90e366e 100644 --- a/roles/kube-node/tasks/offline.yml +++ b/roles/kube-node/tasks/offline.yml @@ -39,3 +39,15 @@ - 'ansible_distribution == "CentOS"' - 'ansible_distribution_major_version == "7"' ignore_errors: true + +- block: + - name: 分发 haproxy_stretch 离线包 + copy: + src: "{{ base_dir }}/down/packages/haproxy_stretch.tar.gz" + dest: "/opt/kube/packages/haproxy/haproxy_stretch.tar.gz" + + - name: 安装 haproxy_stretch 离线包 + shell: 'cd /opt/kube/packages/haproxy && tar zxf haproxy_stretch.tar.gz && \ + dpkg -i *.deb > /tmp/install_haproxy.log 2>&1' + when: ansible_distribution_release == "stretch" + ignore_errors: true diff --git a/roles/prepare/tasks/offline.yml b/roles/prepare/tasks/offline.yml index 5c4a7ff..5716f1f 100644 --- a/roles/prepare/tasks/offline.yml +++ b/roles/prepare/tasks/offline.yml @@ -49,3 +49,20 @@ - 'ansible_distribution == "CentOS"' - 'ansible_distribution_major_version == "7"' ignore_errors: true + +- block: + - name: 分发 basic_stretch 离线包 + copy: + src: "{{ base_dir }}/down/packages/basic_stretch.tar.gz" + dest: "/opt/kube/packages/basic/basic_stretch.tar.gz" + + # 离线安装包可能需要安装多次才能成功 + - name: 安装 basic_stretch 离线包 + shell: 'cd /opt/kube/packages/basic && tar zxf basic_stretch.tar.gz && \ + dpkg -i *.deb > /tmp/install_basic.log 2>&1' + register: install_info + until: not install_info.failed + retries: 3 + delay: 1 + when: ansible_distribution_release == "stretch" + ignore_errors: true