热门课程

免费试听

上课方式

开班时间

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

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.

大家都在看

Cookie真的走向灭亡了吗?个人隐私何去何从?

2024-07-09 浏览次数:0

面试被问到redis优势怎么回答?面试成功秘诀

2024-07-09 浏览次数:0

搜索引擎Solr介绍

2024-07-09 浏览次数:0

软件测试培训费用大概多少?免费试听真的假的?

2024-07-09 浏览次数:0

渗透测试怎么做?渗透测试技术速览及盘点

2024-07-09 浏览次数:0

【开班】知了堂2019年最后一期班正式开班

2024-07-09 浏览次数:0
最新资讯
知了汇智实训课程及系列讲座,走...   产教融合是推动教育与产业发展紧密结合的重要途径,校企合作则是实现产教融合的关键。  为进一步优化...
自学网络安全学习路线、阶段目标...   网络安全学习路线图请收好!  第一部分:基础篇。  主要包括安全导论、安全法律法规、操作系统应用...
如何编辑html网页?编辑工具...   建站最基础的除了域名和服务器,更重要的是一个有一个相关连的html网页。如何编辑html网页?编...
JSP 与 Servlet 的...   Jsp 和 Servlet 均是学习 Java 的重要途径,那么您是否了解它们之间的区别与联系呢...
什么是静态测试?静态测试工具有...   做过软件测试的人都应该对测试方式烂熟于心,如白盒测试,黑盒测试,性能测试,动态测试,静态测试等等...
什么是静态测试?静态测试工具有...   做过软件测试的人都应该对测试方式烂熟于心,如白盒测试,黑盒测试,性能测试,动态测试,静态测试等等...
上万条转行贴刷爆小红书豆瓣,软... 小红书/豆瓣上万条转行贴刷屏,软件测试、程序开发拔头筹!上万条转行贴刷爆小红书豆瓣,软件测试、程序开...
有哪些免费的ai工具?按头推荐...        大家好,我是知了姐。        说到AIGC工具,你还是只知道ChatGPT?...