fix: installing offline system packages

v3.3
gjmzj 2022-11-30 09:24:42 +08:00
parent 7659b9c03f
commit 3748cba21e
1 changed files with 7 additions and 75 deletions

View File

@ -3,54 +3,20 @@
file: name=/opt/kube/packages/basic state=directory
- block:
- name: 分发 basic_xenial 离线包
- name: 分发{{ ansible_distribution_release }}离线包
copy:
src: "{{ base_dir }}/down/packages/basic_xenial.tar.gz"
dest: "/opt/kube/packages/basic/basic_xenial.tar.gz"
src: "{{ base_dir }}/down/packages/basic_{{ ansible_distribution_release }}.tar.gz"
dest: "/opt/kube/packages/basic/basic_{{ ansible_distribution_release }}.tar.gz"
# 离线安装包可能需要安装多次才能成功
- name: 安装 basic_xenial 离线包
shell: 'cd /opt/kube/packages/basic && tar zxf basic_xenial.tar.gz && \
- name: 安装{{ ansible_distribution_release }} 离线包
shell: 'cd /opt/kube/packages/basic && tar zxf basic_{{ ansible_distribution_release }}.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 == "xenial"
ignore_errors: true
- block:
- name: 分发 basic_bionic 离线包
copy:
src: "{{ base_dir }}/down/packages/basic_bionic.tar.gz"
dest: "/opt/kube/packages/basic/basic_bionic.tar.gz"
# 离线安装包可能需要安装多次才能成功
- name: 安装 basic_bionic 离线包
shell: 'cd /opt/kube/packages/basic && tar zxf basic_bionic.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 == "bionic"
ignore_errors: true
- block:
- name: 分发 basic_focal 离线包
copy:
src: "{{ base_dir }}/down/packages/basic_focal.tar.gz"
dest: "/opt/kube/packages/basic/basic_focal.tar.gz"
# 离线安装包可能需要安装多次才能成功
- name: 安装 basic_focal 离线包
shell: 'cd /opt/kube/packages/basic && tar zxf basic_focal.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 == "focal"
when: 'ansible_distribution in ["Ubuntu","Debian"]'
ignore_errors: true
- block:
@ -63,40 +29,6 @@
shell: 'cd /opt/kube/packages/basic && tar zxf basic_centos7.tar.gz && \
rpm -Uvh --force --nodeps *.rpm > /tmp/install_basic.log 2>&1'
when:
- 'ansible_distribution == "CentOS"'
- 'ansible_distribution in ["CentOS","RedHat"]'
- '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
- block:
- name: 分发 basic_buster 离线包
copy:
src: "{{ base_dir }}/down/packages/basic_buster.tar.gz"
dest: "/opt/kube/packages/basic/basic_buster.tar.gz"
# 离线安装包可能需要安装多次才能成功
- name: 安装 basic_buster 离线包
shell: 'cd /opt/kube/packages/basic && tar zxf basic_buster.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 == "buster"
ignore_errors: true