mirror of https://github.com/easzlab/kubeasz.git
fix: ansible connect local python interpreter problem
parent
11bd2b2780
commit
9206514de7
|
@ -70,3 +70,6 @@ ca_dir="/etc/kubernetes/ssl"
|
|||
|
||||
# Default 'k8s_nodename' is empty
|
||||
k8s_nodename=''
|
||||
|
||||
# Default python interpreter
|
||||
ansible_python_interpreter=/usr/bin/python3
|
||||
|
|
|
@ -75,3 +75,6 @@ ca_dir="/etc/kubernetes/ssl"
|
|||
|
||||
# Default 'k8s_nodename' is empty
|
||||
k8s_nodename=''
|
||||
|
||||
# Default python interpreter
|
||||
ansible_python_interpreter=/usr/bin/python3
|
||||
|
|
9
ezctl
9
ezctl
|
@ -337,9 +337,6 @@ function add-node() {
|
|||
# check if the new node already exsited
|
||||
sed -n '/^\[kube_master/,/^\[harbor/p' "$BASE/clusters/$1/hosts"|grep -E "^$2$|^$2 " && { logger error "node $2 already existed in $BASE/clusters/$1/hosts"; return 2; }
|
||||
|
||||
# add '/usr/bin/python' soft link, needed in some OS (ubuntu 16.04+)
|
||||
ssh "$2" ln -s /usr/bin/python3 /usr/bin/python > /dev/null 2>&1 || echo ""
|
||||
|
||||
logger info "add $2 into 'kube_node' group"
|
||||
NODE_INFO="${@:2}"
|
||||
sed -i "/\[kube_node/a $NODE_INFO" "$BASE/clusters/$1/hosts"
|
||||
|
@ -355,9 +352,6 @@ function add-master() {
|
|||
# check if the new master already exsited
|
||||
sed -n '/^\[kube_master/,/^\[kube_node/p' "$BASE/clusters/$1/hosts"|grep -E "^$2$|^$2 " && { logger error "master $2 already existed!"; return 2; }
|
||||
|
||||
# add '/usr/bin/python' soft link, needed in some OS (ubuntu 16.04+)
|
||||
ssh "$2" ln -s /usr/bin/python3 /usr/bin/python > /dev/null 2>&1 || echo ""
|
||||
|
||||
logger info "add $2 into 'kube_master' group"
|
||||
MASTER_INFO="${@:2}"
|
||||
sed -i "/\[kube_master/a $MASTER_INFO" "$BASE/clusters/$1/hosts"
|
||||
|
@ -379,9 +373,6 @@ function add-etcd() {
|
|||
# check if the new node already exsited
|
||||
sed -n '/^\[etcd/,/^\[kube_master/p' "$BASE/clusters/$1/hosts"|grep -E "^$2$|^$2 " && { logger error "etcd $2 already existed!"; return 2; }
|
||||
|
||||
# add '/usr/bin/python' soft link, needed in some OS (ubuntu 16.04+)
|
||||
ssh "$2" ln -s /usr/bin/python3 /usr/bin/python > /dev/null 2>&1 || echo ""
|
||||
|
||||
logger info "add $2 into 'etcd' group"
|
||||
ETCD_INFO="${@:2}"
|
||||
sed -i "/\[etcd/a $ETCD_INFO" "$BASE/clusters/$1/hosts"
|
||||
|
|
6
ezdown
6
ezdown
|
@ -571,12 +571,6 @@ function start_kubeasz_docker() {
|
|||
ssh-keyscan -t ecdsa -H "$host_ip" >> /root/.ssh/known_hosts
|
||||
fi
|
||||
|
||||
# create a link '/usr/bin/python' in Ubuntu1604
|
||||
if [[ ! -e /usr/bin/python && -e /usr/bin/python3 ]]; then
|
||||
logger debug "create a soft link '/usr/bin/python'"
|
||||
ln -s /usr/bin/python3 /usr/bin/python
|
||||
fi
|
||||
|
||||
# run kubeasz docker container
|
||||
docker run --detach \
|
||||
--env HOST_IP="$host_ip" \
|
||||
|
|
|
@ -20,14 +20,6 @@
|
|||
- "{{ ca_dir }}"
|
||||
- /root/.kube
|
||||
|
||||
# 某些系统没有/usr/bin/python,需要配置一个软链接,否则connection: local的任务会失败
|
||||
# 如果仍旧出现任务失败,重新执行一遍即可 https://github.com/ansible/ansible/issues/64903
|
||||
- name: symlink /usr/bin/python -> /usr/bin/python3
|
||||
raw: |
|
||||
if [ -f /usr/bin/python3 ] && [ ! -f /usr/bin/python ]; then
|
||||
ln --symbolic /usr/bin/python3 /usr/bin/python;
|
||||
fi
|
||||
|
||||
- name: 写入环境变量$PATH
|
||||
lineinfile:
|
||||
dest: ~/.bashrc
|
||||
|
|
Loading…
Reference in New Issue