fix 兼容ansible执行节点与deploy节点分离

pull/294/head
gjmzj 2018-08-11 09:14:03 +08:00
parent fb5557e54f
commit 30b6ebb59f
4 changed files with 8 additions and 5 deletions

View File

@ -7,7 +7,7 @@
- /opt/kube/images
- name: 复制CA 证书到calico 证书目录
copy: src={{ ca_dir }}/ca.pem dest=/etc/calico/ssl/ca.pem
shell: "cp {{ ca_dir }}/ca.pem /etc/calico/ssl/ca.pem"
- name: 创建calico 证书请求
template: src=calico-csr.json.j2 dest=/etc/calico/ssl/calico-csr.json

View File

@ -117,3 +117,6 @@
- name: 移动 kube-proxy.kubeconfig
shell: "mv /root/kube-proxy.kubeconfig /etc/kubernetes/"
# 兼容ansible执行节点与deploy节点分离情况
- name: 复制 manifests至 deploy节点
copy: src={{ base_dir }}/manifests dest={{ base_dir }}/manifests

View File

@ -32,7 +32,7 @@
- name: 安装bootstrap.kubeconfig配置文件
synchronize: src=/etc/kubernetes/bootstrap.kubeconfig dest=/etc/kubernetes/bootstrap.kubeconfig
delegate_to: "{{ hostvars[inventory_hostname].groups.deploy[0] }}"
delegate_to: "{{ groups.deploy[0] }}"
- name: 准备 cni配置文件
template: src=cni-default.conf.j2 dest=/etc/cni/net.d/10-default.conf
@ -52,7 +52,7 @@
##-------kube-proxy部分----------------
- name: 安装kube-proxy.kubeconfig配置文件
synchronize: src=/etc/kubernetes/kube-proxy.kubeconfig dest=/etc/kubernetes/kube-proxy.kubeconfig
delegate_to: "{{ hostvars[inventory_hostname].groups.deploy[0] }}"
delegate_to: "{{ groups.deploy[0] }}"
- name: 创建kube-proxy 服务文件
tags: reload-kube-proxy, upgrade_k8s, restart_node

View File

@ -79,7 +79,7 @@
- name: 安装kubeconfig配置文件
synchronize: src=/root/.kube/config dest=/root/.kube/config
delegate_to: "{{ hostvars[inventory_hostname].groups.deploy[0] }}"
delegate_to: "{{ groups.deploy[0] }}"
- name: 分发CA 证书
synchronize: src={{ ca_dir }}/{{ item }} dest={{ ca_dir }}/{{ item }}
@ -88,7 +88,7 @@
- ca-key.pem
- ca.csr
- ca-config.json
delegate_to: "{{ hostvars[inventory_hostname].groups.deploy[0] }}"
delegate_to: "{{ groups.deploy[0] }}"
- name: 添加 kubectl 命令自动补全
lineinfile: