- name: prepare some dirs file: name={{ cluster_dir }}/yml/dashboard state=directory run_once: true connection: local - name: 准备 dashboard的部署文件 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 - name: 创建 dashboard部署 shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/dashboard/" run_once: true connection: local