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