允许系统免秘钥执行 sudo
# User privilege specification
root ALL=(ALL:ALL) ALL
huyi ALL=(ALL) NOPASSWD: ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) NOPASSWD: ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
## ssh 权限修改
重新设置root 密码
passwd root
在当前管理员账号创建ssh 公钥并授权给所有目标设备
huyi@k8s-master:~$ sudo ssh-keygen
ssh_config.sh 脚本复制到所有设备,执行脚本允许root 用户登录ssh,复制ssh 秘钥
bash -x ssh_config.sh
sudo ssh-copy-id root@192.168.1.117
ansible 安装
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt-get -y install python-minimal python-apt python-pip python-dev #每台宿主机都要安装 python2
sudo apt-get install ansible -y
### pip 麒麟系统 python 特殊依赖包
pip install setuptools
sudo apt-get install python-dev
pip install wheel -i https://mirrors.aliyun.com/pypi/simple
pip install PyYAML -i https://mirrors.aliyun.com/pypi/simple
apt-get autoremove python-pkg-resources