RHEL7 安装
在控制 节点/etc/hosts 文件生成其它节点dns 名称
cat >>/etc/hosts<<EOF
192.168.200.27 node1
192.168.200.28 node2
192.168.200.29 node3
192.168.200.30 node4
192.168.200.31 node5
192.168.200.32 node6
192.168.200.33 node7
EOF
cat >> /etc/yum.repos.d/epel.repo <<'EOF'
[epel]
name=epel repo
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch
enabled=1
gpgcheck=0
EOF
yum update
yum install ansible -y
Ansible 命令行补全功能
https://cn-ansibledoc.readthedocs.io/zh-cn/latest/installation_guide/intro_installation.html#id2
$ sudo yum install epel-release
$ sudo yum install python-argcomplete
#激活命令行实例功能
activate-global-python-argcomplete
配置ssh 互信
1、控制节点生成ssh 密钥对
ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ''
2、将各节点的主机信息(host key)写入control_node的~/.ssh/known_hosts文件:
for host in 10.100.10.{64..83} node{01..07};do
ssh-keyscan $host >>~/.ssh/known_hosts 2>/dev/null
done
3、.将control_node上的ssh公钥分发给各节点:
# sshpass -p选项指定的是密码
for host in 10.100.10.{64..83} node{01..07};do
sshpass -p'Thtf#997' ssh-copy-id root@$host &>/dev/null
done