2018-09-02 14:08:51 +08:00
|
|
|
# 系统基础软件环境
|
|
|
|
- import_tasks: debian.yml
|
|
|
|
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Debian"
|
|
|
|
|
|
|
|
- import_tasks: centos.yml
|
|
|
|
when: ansible_distribution == "CentOS"
|
|
|
|
|
2017-11-11 19:14:21 +08:00
|
|
|
- name: prepare some dirs
|
|
|
|
file: name={{ item }} state=directory
|
|
|
|
with_items:
|
|
|
|
- "{{ bin_dir }}"
|
|
|
|
- "{{ ca_dir }}"
|
|
|
|
- /root/.kube
|
|
|
|
|
2018-03-16 18:23:34 +08:00
|
|
|
- name: 下载证书工具 CFSSL和 kubectl
|
2017-11-11 19:14:21 +08:00
|
|
|
copy: src={{ base_dir }}/bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755
|
|
|
|
with_items:
|
|
|
|
- cfssl
|
|
|
|
- cfssl-certinfo
|
|
|
|
- cfssljson
|
2018-03-16 18:23:34 +08:00
|
|
|
- kubectl
|
2018-05-11 11:07:14 +08:00
|
|
|
tags: upgrade_k8s
|
2018-03-16 18:23:34 +08:00
|
|
|
|
2018-09-02 14:08:51 +08:00
|
|
|
- name: 分发 kubeconfig配置文件
|
2018-08-05 19:30:57 +08:00
|
|
|
synchronize: src=/root/.kube/config dest=/root/.kube/config
|
2018-08-11 09:14:03 +08:00
|
|
|
delegate_to: "{{ groups.deploy[0] }}"
|
2018-08-05 19:30:57 +08:00
|
|
|
|
2018-09-02 14:08:51 +08:00
|
|
|
- name: 分发 CA 证书
|
2018-08-05 19:30:57 +08:00
|
|
|
synchronize: src={{ ca_dir }}/{{ item }} dest={{ ca_dir }}/{{ item }}
|
|
|
|
with_items:
|
|
|
|
- ca.pem
|
|
|
|
- ca-key.pem
|
|
|
|
- ca.csr
|
|
|
|
- ca-config.json
|
2018-08-11 09:14:03 +08:00
|
|
|
delegate_to: "{{ groups.deploy[0] }}"
|
2018-08-05 19:30:57 +08:00
|
|
|
|
2018-09-02 14:08:51 +08:00
|
|
|
- name: 写入环境变量$PATH
|
|
|
|
lineinfile:
|
|
|
|
dest: ~/.bashrc
|
|
|
|
state: present
|
|
|
|
regexp: 'kubeasz'
|
|
|
|
line: 'export PATH={{ bin_dir }}:$PATH # generated by kubeasz'
|
|
|
|
|
2018-03-16 17:52:02 +08:00
|
|
|
- name: 添加 kubectl 命令自动补全
|
2018-05-04 22:11:08 +08:00
|
|
|
lineinfile:
|
2018-05-06 09:08:09 +08:00
|
|
|
dest: ~/.bashrc
|
2018-05-04 22:11:08 +08:00
|
|
|
state: present
|
|
|
|
regexp: 'kubectl completion'
|
|
|
|
line: 'source <(kubectl completion bash)'
|
2017-12-28 14:34:04 +08:00
|
|
|
|
2018-09-02 14:08:51 +08:00
|
|
|
# 公共系统参数设置
|
|
|
|
- import_tasks: common.yml
|