kubeasz/roles/cluster-addon/tasks/main.yml

33 lines
1.5 KiB
YAML
Raw Normal View History

2018-06-17 23:19:04 +08:00
# kubedns.yaml文件中部分参数根据hosts文件设置而定因此需要用template模块替换参数
- name: 准备 kubedns的部署文件 kubedns.yaml
template: src=kubedns.yaml.j2 dest={{ base_dir }}/manifests/kubedns/kubedns.yaml
# coredns.yaml文件中部分参数根据hosts文件设置而定因此需要用template模块替换参数
- name: 准备 coredns的部署文件 coredns.yaml
template: src=coredns.yaml.j2 dest={{ base_dir }}/manifests/coredns/coredns.yaml
- name: 获取所有已经创建的POD信息
command: "{{ bin_dir }}/kubectl get pod -n kube-system"
register: pod_info
- name: 创建 {{ dns_backend }}部署
2018-06-18 00:04:00 +08:00
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/{{ dns_backend }}"
2018-06-17 23:19:04 +08:00
when: 'dns_backend not in pod_info.stdout and dns_install == "yes"'
ignore_errors: true
2018-06-17 23:19:04 +08:00
- name: 创建 metrics-server部署
2018-06-18 00:04:00 +08:00
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/metrics-server"
2018-06-17 23:19:04 +08:00
when: '"metrics-server" not in pod_info.stdout and metricsserver_install == "yes"'
ignore_errors: true
2018-06-17 23:19:04 +08:00
- name: 创建 dashboard部署
2018-06-18 00:04:00 +08:00
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/dashboard"
2018-06-17 23:19:04 +08:00
when: '"kubernetes-dashboard" not in pod_info.stdout and dashboard_install == "yes"'
ignore_errors: true
2018-06-17 23:19:04 +08:00
- name: 创建 heapster部署
2018-06-18 00:04:00 +08:00
shell: "sleep 5; {{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/heapster"
2018-06-17 23:19:04 +08:00
when: '"heapster" not in pod_info.stdout and heapster_install == "yes"'
ignore_errors: true
2018-06-17 23:19:04 +08:00