Skip to content

Commit

Permalink
fix: 在本地目录检查离线镜像下载情况
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmzj committed Oct 14, 2018
1 parent 56b2c8e commit 6802913
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 22 deletions.
10 changes: 6 additions & 4 deletions roles/calico/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@

- name: 配置 calico rbac
template: src=calico-rbac.yaml.j2 dest=/opt/kube/kube-system/calico/calico-rbac.yaml

- name: 检查是否已下载离线calico镜像
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true

- name: 检查是否已下载离线calico镜像
command: "ls {{ base_dir }}/down"
register: download_info
connection: local
run_once: true

- name: node 节点创建calico 相关目录
file: name={{ item }} state=directory
Expand Down
10 changes: 6 additions & 4 deletions roles/cilium/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
- name: 配置 cilium DaemonSet yaml文件
template: src=cilium.yaml.j2 dest=/opt/kube/kube-system/cilium/cilium.yaml
tags: reconf

- name: 检查是否已下载离线cilium镜像
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true

- name: 检查是否已下载离线cilium镜像
command: "ls {{ base_dir }}/down"
register: download_info
connection: local
run_once: true

- name: node 节点创建cilium 相关目录
file: name={{ item }} state=directory
Expand Down
10 changes: 6 additions & 4 deletions roles/cluster-addon/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
- name: 获取所有已经创建的POD信息
command: "{{ bin_dir }}/kubectl get pod -n kube-system"
register: pod_info

- name: 获取已下载离线镜像信息
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true

- name: 获取已下载离线镜像信息
command: "ls {{ base_dir }}/down"
register: download_info
connection: local
run_once: true

- block:
- name: 尝试推送离线{{ dns_backend }}镜像(若执行失败,可忽略)
copy: src={{ base_dir }}/down/{{ dns_offline }} dest=/opt/kube/images/{{ dns_offline }}
Expand Down
5 changes: 3 additions & 2 deletions roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
with_items:
- "{{ bin_dir }}"
- "{{ ca_dir }}"
- "{{ base_dir }}/down"
- "{{ base_dir }}"
- "/etc/kubernetes"

- name: 下载证书工具 CFSSL和 kubectl
Expand Down Expand Up @@ -98,7 +98,8 @@

# --- 以下为兼容ansible执行节点与deploy节点分离情况-------
- name: 复制 manifests至 deploy节点
copy: src={{ base_dir }}/manifests dest={{ base_dir }}
#copy: src={{ base_dir }}/manifests dest={{ base_dir }}
synchronize: src={{ base_dir }}/manifests dest={{ base_dir }}
when: "ansible_env['SSH_CLIENT'].split(' ')[0] != inventory_hostname"

- name: 推送 ssh 密钥对至 deploy节点
Expand Down
10 changes: 6 additions & 4 deletions roles/flannel/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

- name: 配置 flannel DaemonSet yaml文件
template: src=kube-flannel.yaml.j2 dest=/opt/kube/kube-system/flannel/kube-flannel.yaml

- name: 检查是否已下载离线flannel镜像
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true

- name: 检查是否已下载离线flannel镜像
command: "ls {{ base_dir }}/down"
register: download_info
connection: local
run_once: true

- name: 创建flannel cni 相关目录
file: name={{ item }} state=directory
with_items:
Expand Down
10 changes: 6 additions & 4 deletions roles/kube-router/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
- name: 准备配置 kube-router DaemonSet (with IPVS)
template: src=kuberouter-all.yaml.j2 dest=/opt/kube/kube-system/kube-router/kuberouter.yaml
when: 'SERVICE_PROXY == "true"'

- name: 检查是否已下载离线kube-router镜像
command: "ls {{ base_dir }}/down"
register: download_info
delegate_to: "{{ groups.deploy[0] }}"
run_once: true

- name: 检查是否已下载离线kube-router镜像
command: "ls {{ base_dir }}/down"
register: download_info
connection: local
run_once: true

- name: 创建cni 和kube-router 相关目录
file: name={{ item }} state=directory
Expand Down

0 comments on commit 6802913

Please sign in to comment.