mirror of https://github.com/easzlab/kubeasz.git
53 lines
1.3 KiB
YAML
53 lines
1.3 KiB
YAML
# 系统基础软件环境
|
|
- import_tasks: debian.yml
|
|
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Debian"
|
|
|
|
- import_tasks: centos.yml
|
|
when: ansible_distribution == "CentOS"
|
|
|
|
- name: prepare some dirs
|
|
file: name={{ item }} state=directory
|
|
with_items:
|
|
- "{{ bin_dir }}"
|
|
- "{{ ca_dir }}"
|
|
- /root/.kube
|
|
|
|
- name: 下载证书工具 CFSSL和 kubectl
|
|
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
|
|
with_items:
|
|
- cfssl
|
|
- cfssl-certinfo
|
|
- cfssljson
|
|
- kubectl
|
|
tags: upgrade_k8s
|
|
|
|
- name: 分发 kubeconfig配置文件
|
|
synchronize: src=/root/.kube/config dest=/root/.kube/config
|
|
delegate_to: "{{ groups.deploy[0] }}"
|
|
|
|
- name: 分发 CA 证书
|
|
synchronize: src={{ ca_dir }}/{{ item }} dest={{ ca_dir }}/{{ item }}
|
|
with_items:
|
|
- ca.pem
|
|
- ca-key.pem
|
|
- ca.csr
|
|
- ca-config.json
|
|
delegate_to: "{{ groups.deploy[0] }}"
|
|
|
|
- name: 写入环境变量$PATH
|
|
lineinfile:
|
|
dest: ~/.bashrc
|
|
state: present
|
|
regexp: 'kubeasz'
|
|
line: 'export PATH={{ bin_dir }}:$PATH # generated by kubeasz'
|
|
|
|
- name: 添加 kubectl 命令自动补全
|
|
lineinfile:
|
|
dest: ~/.bashrc
|
|
state: present
|
|
regexp: 'kubectl completion'
|
|
line: 'source <(kubectl completion bash)'
|
|
|
|
# 公共系统参数设置
|
|
- import_tasks: common.yml
|