2018-12-21 22:35:15 +08:00
|
|
|
|
- block:
|
2019-05-18 18:07:34 +08:00
|
|
|
|
- block:
|
|
|
|
|
- name: 尝试推送离线 traefik镜像(若执行失败,可忽略)
|
|
|
|
|
copy: src={{ base_dir }}/down/{{ traefik_offline }} dest=/opt/kube/images/{{ traefik_offline }}
|
|
|
|
|
when: 'traefik_offline in download_info.stdout'
|
|
|
|
|
|
|
|
|
|
- name: 获取traefik离线镜像推送情况
|
|
|
|
|
command: "ls /opt/kube/images"
|
|
|
|
|
register: image_info
|
|
|
|
|
|
|
|
|
|
- name: 导入 traefik的离线镜像(若执行失败,可忽略)
|
|
|
|
|
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ traefik_offline }}"
|
2019-05-21 23:47:49 +08:00
|
|
|
|
when: 'traefik_offline in image_info.stdout and CONTAINER_RUNTIME == "docker"'
|
|
|
|
|
|
|
|
|
|
- name: 导入 traefik的离线镜像(若执行失败,可忽略)
|
|
|
|
|
shell: "{{ bin_dir }}/ctr -n=k8s.io images import /opt/kube/images/{{ traefik_offline }}"
|
|
|
|
|
when: 'traefik_offline in image_info.stdout and CONTAINER_RUNTIME == "containerd"'
|
2018-12-21 22:35:15 +08:00
|
|
|
|
|
|
|
|
|
- name: 创建 traefik部署
|
2019-05-29 20:45:25 +08:00
|
|
|
|
shell: "{{ base_dir }}/bin/kubectl apply -f {{ base_dir }}/manifests/ingress/traefik/traefik-ingress.yaml"
|
|
|
|
|
connection: local
|
2018-12-21 22:35:15 +08:00
|
|
|
|
run_once: true
|
|
|
|
|
when: 'ingress_backend == "traefik"'
|
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
|
|
- block:
|
2019-05-18 18:07:34 +08:00
|
|
|
|
- block:
|
|
|
|
|
- name: 尝试推送离线 nginx-ingress镜像(若执行失败,可忽略)
|
|
|
|
|
copy: src={{ base_dir }}/down/{{ nginx_ingress_offline }} dest=/opt/kube/images/{{ nginx_ingress_offline }}
|
|
|
|
|
when: 'nginx_ingress_offline in download_info.stdout'
|
|
|
|
|
|
|
|
|
|
- name: 获取nginx_ingress离线镜像推送情况
|
|
|
|
|
command: "ls /opt/kube/images"
|
|
|
|
|
register: image_info
|
|
|
|
|
|
|
|
|
|
- name: 导入 nginx_ingress的离线镜像(若执行失败,可忽略)
|
|
|
|
|
shell: "{{ bin_dir }}/docker load -i /opt/kube/images/{{ nginx_ingress_offline }}"
|
2019-05-21 23:47:49 +08:00
|
|
|
|
when: 'nginx_ingress_offline in image_info.stdout and CONTAINER_RUNTIME == "docker"'
|
|
|
|
|
|
|
|
|
|
- name: 导入 nginx_ingress的离线镜像(若执行失败,可忽略)
|
|
|
|
|
shell: "{{ bin_dir }}/ctr -n=k8s.io images import /opt/kube/images/{{ nginx_ingress_offline }}"
|
|
|
|
|
when: 'nginx_ingress_offline in image_info.stdout and CONTAINER_RUNTIME == "containerd"'
|
2018-12-21 22:35:15 +08:00
|
|
|
|
|
|
|
|
|
- name: 创建 nginx_ingress部署
|
2019-05-29 20:45:25 +08:00
|
|
|
|
shell: "{{ base_dir }}/bin/kubectl apply -f {{ base_dir }}/manifests/ingress/nginx-ingress/nginx-ingress.yaml"
|
|
|
|
|
connection: local
|
2018-12-21 22:35:15 +08:00
|
|
|
|
run_once: true
|
|
|
|
|
when: 'ingress_backend == "nginx-ingress"'
|
|
|
|
|
ignore_errors: true
|