fix 离线安装基础软件包

pull/641/head
gjmzj 2019-06-29 18:10:51 +08:00
parent 657d2c12d8
commit 06c811203d
7 changed files with 43 additions and 22 deletions

View File

@ -3,8 +3,15 @@
when: ansible_distribution == "Ubuntu" and INSTALL_SOURCE != "offline"
ignore_errors: true
- name: 确保已卸载ntp
package: name=ntp state=absent
- name: apt 卸载 ntp
shell: 'apt remove -y ntp'
when: ansible_distribution == "Ubuntu"
ignore_errors: true
- name: yum 卸载 ntp
shell: 'yum remove -y ntp'
when: 'ansible_distribution in ["CentOS","RedHat","Amazon"]'
ignore_errors: true
- name: 安装 chrony
package: name=chrony state=present

View File

@ -12,6 +12,7 @@
shell: 'cd /opt/kube/packages/chrony && tar zxf chrony_xenial.tar.gz && \
dpkg -i *.deb > /tmp/install_chrony.log 2>&1'
when: ansible_distribution_release == "xenial"
ignore_errors: true
- block:
- name: 分发 chrony_centos7 离线包
@ -21,7 +22,8 @@
- name: 安装 chrony_centos7 离线包
shell: 'cd /opt/kube/packages/chrony && tar zxf chrony_centos7.tar.gz && \
rpm -Uvh --nodeps *.rpm > /tmp/install_chrony.log 2>&1'
rpm -Uvh --force --nodeps *.rpm > /tmp/install_chrony.log 2>&1'
when:
- 'ansible_distribution_major_version == "7"'
- 'ansible_distribution == "CentOS"'
ignore_errors: true

View File

@ -12,6 +12,7 @@
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"
ignore_errors: true
- block:
- name: 分发 haproxy_centos7 离线包
@ -21,10 +22,11 @@
- 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'
rpm -Uvh --force --nodeps *.rpm > /tmp/install_haproxy.log 2>&1'
when:
- 'ansible_distribution == "CentOS"'
- 'ansible_distribution_major_version == "7"'
ignore_errors: true
# 离线安装 keepalived
- name: 准备离线安装包目录
@ -40,6 +42,7 @@
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"
ignore_errors: true
- block:
- name: 分发 keepalived_centos7 离线包
@ -49,8 +52,8 @@
- 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'
rpm -Uvh --force --nodeps *.rpm > /tmp/install_keepalived.log 2>&1'
when:
- 'ansible_distribution == "CentOS"'
- 'ansible_distribution_major_version == "7"'
ignore_errors: true

View File

@ -12,6 +12,7 @@
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"
ignore_errors: true
- block:
- name: 分发 haproxy_centos7 离线包
@ -21,7 +22,8 @@
- 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'
rpm -Uvh --force --nodeps *.rpm > /tmp/install_haproxy.log 2>&1'
when:
- 'ansible_distribution == "CentOS"'
- 'ansible_distribution_major_version == "7"'
ignore_errors: true

View File

@ -1,10 +1,10 @@
- name: 删除centos/redhat默认安装
yum:
name:
- firewalld
- python-firewall
- firewalld-filesystem
state: absent
shell: "yum remove -y {{ item }}"
with_items:
- firewalld
- python-firewall
- firewalld-filesystem
ignore_errors: true
#- name: 添加EPEL仓库
# yum: name=epel-release state=present

View File

@ -8,10 +8,16 @@
src: "{{ base_dir }}/down/packages/basic_xenial.tar.gz"
dest: "/opt/kube/packages/basic/basic_xenial.tar.gz"
# 离线安装包可能需要安装多次才能成功
- name: 安装 basic_xenial 离线包
shell: 'cd /opt/kube/packages/basic && tar zxf basic_xenial.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_centos7 离线包
@ -21,7 +27,8 @@
- name: 安装 basic_centos7 离线包
shell: 'cd /opt/kube/packages/basic && tar zxf basic_centos7.tar.gz && \
rpm -Uvh --nodeps *.rpm > /tmp/install_basic.log 2>&1'
rpm -Uvh --force --nodeps *.rpm > /tmp/install_basic.log 2>&1'
when:
- 'ansible_distribution == "CentOS"'
- 'ansible_distribution_major_version == "7"'
ignore_errors: true

View File

@ -1,13 +1,13 @@
# 删除默认安装
- name: 删除ubuntu默认安装
apt:
name:
- ufw
- lxd
- lxd-client
- lxcfs
- lxc-common
state: absent
shell: "apt remove -y {{ item }}"
with_items:
- ufw
- lxd
- lxd-client
- lxcfs
- lxc-common
ignore_errors: true
# Ubuntu 安装基础软件包
- name: 安装 ubuntu基础软件