From 184548336916c70193f6eb0e8d794b27ebf658b5 Mon Sep 17 00:00:00 2001 From: gjmzj Date: Sat, 24 Apr 2021 20:23:06 +0800 Subject: [PATCH] minor fixes --- ezctl | 5 ++++- ezdown | 5 +++-- roles/calico/tasks/main.yml | 2 +- roles/cilium/tasks/main.yml | 2 +- roles/cluster-addon/tasks/main.yml | 4 ++-- roles/flannel/tasks/main.yml | 2 +- roles/kube-router/tasks/main.yml | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ezctl b/ezctl index cd99f40..723441d 100755 --- a/ezctl +++ b/ezctl @@ -266,10 +266,13 @@ function cmd() { ;; esac + COMMAND="ansible-playbook -i clusters/$1/hosts -e @clusters/$1/config.yml playbooks/$PLAY_BOOK" + echo "$COMMAND" + logger info "cluster:$1 $2 begins in 5s, press any key to abort:\n" ! (read -r -t5 -n1) || { logger warn "$2 abort"; return 1; } - ansible-playbook -i "clusters/$1/hosts" -e "@clusters/$1/config.yml" "playbooks/$PLAY_BOOK" || return 1 + ${COMMAND} || return 1 } diff --git a/ezdown b/ezdown index 1a7b484..8bd6f9b 100755 --- a/ezdown +++ b/ezdown @@ -350,9 +350,10 @@ function start_kubeasz_docker() { # run kubeasz docker container docker run --detach \ - --name kubeasz \ - --restart always \ --env HOST_IP="$host_ip" \ + --name kubeasz \ + --network host \ + --restart always \ --volume "$BASE":"$BASE" \ --volume /root/.kube:/root/.kube \ --volume /root/.ssh:/root/.ssh \ diff --git a/roles/calico/tasks/main.yml b/roles/calico/tasks/main.yml index 3a9f441..34836eb 100644 --- a/roles/calico/tasks/main.yml +++ b/roles/calico/tasks/main.yml @@ -82,7 +82,7 @@ # 只需单节点执行一次 - name: 运行 calico网络 - shell: "{{ bin_dir }}/kubectl apply -f {{ cluster_dir }}/yml/calico.yaml" + shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/calico.yaml" run_once: true connection: local diff --git a/roles/cilium/tasks/main.yml b/roles/cilium/tasks/main.yml index a89c33f..5a02683 100644 --- a/roles/cilium/tasks/main.yml +++ b/roles/cilium/tasks/main.yml @@ -65,7 +65,7 @@ # 只需单节点执行一次 - name: 运行 cilium网络 - shell: "{{ bin_dir }}/kubectl apply -f {{ cluster_dir }}/yml/cilium.yaml" + shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/cilium.yaml" run_once: true connection: local diff --git a/roles/cluster-addon/tasks/main.yml b/roles/cluster-addon/tasks/main.yml index 26c0318..7507d40 100644 --- a/roles/cluster-addon/tasks/main.yml +++ b/roles/cluster-addon/tasks/main.yml @@ -67,8 +67,8 @@ # connection: local # # - name: 创建 metallb controller 部署 -# shell: "{{ bin_dir }}/kubectl apply -f {{ cluster_dir }}/yml/metallb.yaml && \ -# {{ bin_dir }}/kubectl apply -f {{ cluster_dir }}/yml/{{ metallb_protocol }}.yaml" +# shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/metallb.yaml && \ +# {{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/{{ metallb_protocol }}.yaml" # run_once: true # connection: local # when: '"metallb" not in pod_info.stdout and metallb_install == "yes"' diff --git a/roles/flannel/tasks/main.yml b/roles/flannel/tasks/main.yml index a3c2590..9d9323b 100644 --- a/roles/flannel/tasks/main.yml +++ b/roles/flannel/tasks/main.yml @@ -57,7 +57,7 @@ # 只需单节点执行一次 - name: 运行 flannel网络 - shell: "{{ bin_dir }}/kubectl apply -f {{ cluster_dir }}/yml/flannel.yaml" + shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/flannel.yaml" run_once: true connection: local diff --git a/roles/kube-router/tasks/main.yml b/roles/kube-router/tasks/main.yml index 52a1eec..12c635d 100644 --- a/roles/kube-router/tasks/main.yml +++ b/roles/kube-router/tasks/main.yml @@ -59,7 +59,7 @@ # 只需单节点执行一次 - name: 运行 kube-router DaemonSet - shell: "{{ bin_dir }}/kubectl apply -f {{ cluster_dir }}/yml/kube-router.yaml" + shell: "{{ base_dir }}/bin/kubectl apply -f {{ cluster_dir }}/yml/kube-router.yaml" run_once: true connection: local