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

35 lines
1.3 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'"
- name: 准备 dashboard的部署文件
template: src=dashboard/kubernetes-dashboard.yaml.j2 dest={{ cluster_dir }}/yml/kubernetes-dashboard.yaml
run_once: true
connection: local
2021-01-11 19:02:34 +08:00
- name: 创建 dashboard部署
shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/kubernetes-dashboard.yaml"
2021-01-11 19:02:34 +08:00
run_once: true
connection: local