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

42 lines
1.4 KiB
YAML
Raw Normal View History

2021-01-11 19:02:34 +08:00
- name: 尝试推送离线 dashboard 镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ item }} dest=/opt/kube/images/{{ item }}
when: 'item in download_info.stdout'
with_items:
- "{{ dashboard_offline }}"
- "{{ metricsscraper_offline }}"
- name: 获取dashboard离线镜像推送情况
command: "ls /opt/kube/images"
register: image_info
- name: 导入 dashboard 的离线镜像docker
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ item }}"
with_items:
- "{{ dashboard_offline }}"
- "{{ metricsscraper_offline }}"
when: "item in image_info.stdout and CONTAINER_RUNTIME == 'docker'"
- name: 导入 dashboard 的离线镜像containerd
shell: "{{ bin_dir }}/ctr -n=k8s.io images import /opt/kube/images/{{ item }}"
with_items:
- "{{ dashboard_offline }}"
- "{{ metricsscraper_offline }}"
when: "item in image_info.stdout and CONTAINER_RUNTIME == 'containerd'"
2021-09-23 21:36:34 +08:00
- name: prepare some dirs
file: name={{ cluster_dir }}/yml/dashboard state=directory
- name: 准备 dashboard的部署文件
2021-09-23 21:36:34 +08:00
template: src=dashboard/{{ item }}.j2 dest={{ cluster_dir }}/yml/dashboard/{{ item }}
with_items:
- "kubernetes-dashboard.yaml"
- "admin-user-sa-rbac.yaml"
- "read-user-sa-rbac.yaml"
run_once: true
connection: local
2021-01-11 19:02:34 +08:00
- name: 创建 dashboard部署
2021-09-23 21:36:34 +08:00
shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/dashboard/"
2021-01-11 19:02:34 +08:00
run_once: true
connection: local