热门课程

免费试听

上课方式

开班时间

当前位置: 首页 -   文章 -   新闻动态 -   正文

Ansible 自动化工具安装、配置

知了堂姐
2024-07-09 11:12:24
0

1 准备工作

1.1 服务器配置

主机:192.168.36.128

Node1:192.168.36.129

Node2:192.168.36.130

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

[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# systemctl disable firewalld

[root@localhost ~]# setenforce 0

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

修改SELINUX=disabled

1.3 同步时间(三台服务器)

安装ntpdata

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

同步时间

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

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

cp: overwrite ‘/etc/localtime’? yes

1.4 安装epel源

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

1.5 安装ansible

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

查看版本

[root@ansible ~]# ansible –version

1.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.

预约申请试听课
大家都在看

接口测试一般怎么测?软件测试之接口测试必学篇

2024-07-09 浏览次数:0

知了堂&内江师范学院实训拉开序幕

2024-07-09 浏览次数:0

什么?程序猿能做的岗位居然这么多!

2024-07-09 浏览次数:0

程序员恋爱语录大全,快来get你的脱单攻略!

2024-07-09 浏览次数:0

农科院展开网络安全讲座

2024-07-09 浏览次数:0

成都网络安全培训机构哪家好

2024-07-09 浏览次数:0
最新资讯
自动化渗透测试工具深度解析:F...   随着网络安全威胁的日益严重,自动化渗透测试工具在保障企业网络安全中扮演着越来越重要的角色。在众多...
自动化渗透测试工具之CS和MS...   在当今网络安全领域,自动化渗透测试工具扮演着至关重要的角色。它们能够帮助安全专家和企业迅速发现系...
自动化渗透测试工具之Nessu...   随着网络技术的飞速发展,网络安全问题日益凸显。为了应对这一挑战,许多组织都采取了渗透测试这一策略...
最好用的17个网络安全渗透测试...   渗透测试,是专业网络安全工程师为找出系统中的漏洞而进行的操作。当然,是在恶意黑客找到这些漏洞之前...
常用的java开发工具有哪些?...   常用的java开发工具有哪些?作为Java程序开发人员,可以选择集成开发环境IDE(Integr...
有哪些免费的ai工具?按头推荐...   大家好,我是知了姐。  说到AIGC工具,你还是只知道ChatGPT?  今天给大家推荐几款适合...
3月14日,汇智知了堂Java...   生活有不期而遇的温暖  学习有不言而喻的乐趣  开班典礼  3月14日上午9点,知了堂开发、网络...
知了汇智实训课程及系列讲座,走...   产教融合是推动教育与产业发展紧密结合的重要途径,校企合作则是实现产教融合的关键。  为进一步优化...