kubeasz/roles/prepare/tasks/main.yml

59 lines
1.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

- name: prepare some dirs
file: name={{ item }} state=directory
with_items:
- "{{ bin_dir }}"
- "{{ ca_dir }}"
- /root/.kube
- /etc/docker
#- name: 集群hosts文件更新
# copy: src=hosts.j2 dest=/etc/hosts
- name: 写入环境变量$PATH
shell: "sed -i '/export PATH=/d' /etc/profile && \
echo export PATH={{ bin_dir }}:$PATH >> /etc/profile"
- name: 下载证书工具 CFSSL
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
with_items:
- cfssl
- cfssl-certinfo
- cfssljson
- name: 分发CA 证书
copy: src={{ item }} dest={{ ca_dir }}/{{ item }} mode=0644
with_items:
- ca.pem
- ca-key.pem
- ca.csr
- ca-config.json
# 先拉取下节点的ansible setup信息起到缓存效果否则后续when 判断可能失败
- name: 缓存ansilbe setup信息
setup: gather_subset=min
# 删除默认安装
- name: 删除ubuntu默认安装
when: ansible_distribution == "Ubuntu"
apt: name={{ item }} state=absent
with_items:
- ufw
- lxd
- lxd-client
- lxcfs
- lxc-common
# 删除默认安装
- name: 删除centos默认安装
when: ansible_distribution == "CentOS"
yum: name={{ item }} state=absent
with_items:
- firewalld
- firewalld-filesystem
- python-firewall
- name: 关闭 selinux
shell: "setenforce 0 && echo SELINUX=disabled > /etc/selinux/config"
when: ansible_distribution == "CentOS"
ignore_errors: true