#!/bin/bash
dir=$(dirname $0)

echo -e "\033[32m>>>>部署ansible\033[0m"
${dir}/shell/install-ansible.sh

\cp ${dir}/config ${dir}/ansible/hosts/hosts

ansible-playbook -i ${dir}/ansible/hosts/hosts ${dir}/ansible/00*                --become  --become-method=sudo --become-user=root
ansible-playbook -i ${dir}/ansible/hosts/hosts ${dir}/ansible/10*
ansible-playbook -i ${dir}/ansible/hosts/hosts ${dir}/ansible/09*                --become  --become-method=sudo --become-user=root
ansible-playbook -i ${dir}/ansible/hosts/hosts ${dir}/ansible/07*                --become  --become-method=sudo --become-user=root --flush-cache
ansible-playbook -i ${dir}/ansible/hosts/hosts ${dir}/ansible/08* --tags=install --become  --become-method=sudo --become-user=root
echo -e "\033[32m>>>>正常执行完此程序之后，去所在的k8s集群'master节点执行kubectl get node'查看node节点是否添加成功\033[0m"
