Ansible自动化工具安装及配置

1、服务器配置

主机:192.168.36.128

Node1:192.168.36.129

Node2:192.168.36.130

2、关闭防火墙,关闭Selinux(三台服务器)

[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# systemctl disable firewalld

[root@localhost ~]# setenforce 0

[root@localhost ~]# vim /etc/selinux/config

修改SELINUX=disabled

3、同步时间(三台服务器)

安装ntpdata

[root@node2 ~]#yum install -y ntpdate

同步时间

[root@node2 ~]# ntpdate http://ntp1.aliyun.com

[root@node2 ~]# cp -a /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

cp: overwrite ‘/etc/localtime’? yes

4、安装epel源

[root@ansible ~]# yum install -y epel-release

5、安装ansible

[root@ansible ~]# yum install -y ansible

查看版本

[root@ansible ~]# ansible –version

6、密钥认证(免密登录)

生成密钥

[root@ansible ~]# ssh-keygen

发送密钥给自己

[root@ansible ~]# ssh-copy-id 192.168.36.128

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

root@192.168.36.128's password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '192.168.36.128'"

and check to make sure that only the key(s) you wanted were added.

发送密钥给Node1

[root@ansible ~]# ssh-copy-id 192.168.36.129

The authenticity of host '192.168.36.129 (192.168.36.129)' can't be established.

ECDSA key fingerprint is a0:69:e4:de:f6:3e:e4:b5:cf:34:83:27:a2:cb:ea:e2.

Are you sure you want to continue connecting (yes/no)? yes

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

root@192.168.36.129's password: 输入远程主机密码

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '192.168.36.129'"

and check to make sure that only the key(s) you wanted were added.

发送密钥给Node2

[root@ansible ~]# ssh-copy-id 192.168.36.130

The authenticity of host '192.168.36.130 (192.168.36.130)' can't be established.

ECDSA key fingerprint is 3a:dc:83:32:62:eb:2f:fe:60:46:9c:4d:8c:3f:ef:87.

Are you sure you want to continue connecting (yes/no)? yes

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

root@192.168.36.130's password: 输入远程主机密码

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '192.168.36.130'"

and check to make sure that only the key(s) you wanted were added.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值