2018-09-02 14:08:51 +08:00
|
|
|
|
# 删除默认安装
|
|
|
|
|
- name: 删除ubuntu默认安装
|
2019-06-29 18:10:51 +08:00
|
|
|
|
shell: "apt remove -y {{ item }}"
|
|
|
|
|
with_items:
|
|
|
|
|
- ufw
|
|
|
|
|
- lxd
|
|
|
|
|
- lxd-client
|
|
|
|
|
- lxcfs
|
|
|
|
|
- lxc-common
|
2019-07-02 21:01:32 +08:00
|
|
|
|
when: ansible_distribution == "Ubuntu"
|
2019-06-29 18:10:51 +08:00
|
|
|
|
ignore_errors: true
|
2018-09-02 14:08:51 +08:00
|
|
|
|
|
2019-07-16 22:47:53 +08:00
|
|
|
|
# 安装基础软件包
|
|
|
|
|
- name: 安装 ubuntu/debian基础软件
|
2018-10-09 15:37:07 +08:00
|
|
|
|
apt:
|
|
|
|
|
name:
|
2019-07-17 09:01:16 +08:00
|
|
|
|
- bash-completion # bash命令补全工具,需要重新登录服务器生效
|
2018-10-09 15:37:07 +08:00
|
|
|
|
- conntrack # network connection cleanup 用到
|
2019-07-17 09:01:16 +08:00
|
|
|
|
- ipset # ipvs 模式需要
|
|
|
|
|
- ipvsadm # ipvs 模式需要
|
2018-10-09 15:37:07 +08:00
|
|
|
|
- jq # 轻量JSON处理程序,安装docker查询镜像需要
|
2019-07-17 09:01:16 +08:00
|
|
|
|
- libseccomp2 # 安装containerd需要
|
|
|
|
|
- nfs-common # 挂载nfs 共享文件需要 (创建基于 nfs的PV 需要)
|
2019-07-18 15:15:57 +08:00
|
|
|
|
- psmisc # 安装psmisc 才能使用命令killall,keepalive的监测脚本需要
|
2018-10-09 15:37:07 +08:00
|
|
|
|
- rsync # 文件同步工具,分发证书等配置文件需要
|
2019-07-17 09:01:16 +08:00
|
|
|
|
- socat # 用于port forwarding
|
2019-04-03 15:02:05 +08:00
|
|
|
|
state: present
|
2019-06-28 12:53:04 +08:00
|
|
|
|
when: 'INSTALL_SOURCE != "offline"'
|
|
|
|
|
|
|
|
|
|
# 离线安装基础软件包
|
|
|
|
|
- import_tasks: offline.yml
|
|
|
|
|
when: 'INSTALL_SOURCE == "offline"'
|
2018-09-02 14:08:51 +08:00
|
|
|
|
|
2019-03-28 18:44:10 +08:00
|
|
|
|
# 优化设置 journal 日志相关,避免日志重复搜集,浪费系统资源
|
|
|
|
|
- name: 准备 journal 日志相关目录
|
|
|
|
|
file: name={{ item }} state=directory
|
|
|
|
|
with_items:
|
|
|
|
|
- "/etc/systemd/journald.conf.d"
|
|
|
|
|
- "/var/log/journal"
|
|
|
|
|
|
|
|
|
|
- name: 优化设置 journal 日志
|
|
|
|
|
template: src=95-k8s-journald.conf.j2 dest=/etc/systemd/journald.conf.d/95-k8s-journald.conf
|
|
|
|
|
|
|
|
|
|
- name: 重启 journald 服务
|
|
|
|
|
service: name=systemd-journald state=restarted
|
2020-09-17 17:01:20 +08:00
|
|
|
|
|
|
|
|
|
- name: Configuration iptables
|
|
|
|
|
shell: 'iptables -F \
|
|
|
|
|
&& iptables -t nat -F \
|
|
|
|
|
&& iptables -t mangle -F \
|
|
|
|
|
&& iptables -X \
|
|
|
|
|
&& update-alternatives --set iptables /usr/sbin/iptables-legacy'
|
|
|
|
|
when: ansible_distribution == "Debian" and ansible_distribution_version|int >= 10
|