当前位置:网站首页>Ansible installation and deployment detailed process, basic operation of configuration inventory
Ansible installation and deployment detailed process, basic operation of configuration inventory
2022-08-03 05:40:00 【Xiao Chen loves exercise】
准备三台机器:
server.example.com
node1.example.com
node2.example.com
The first is cloning3台机器,最好是配置好yum源的,serverMachines need to haveansible,ssh,The other two are requiredssh和python
直接克隆就可以
配置IP,主机名,/etc/hosts
Manually configure the three machines separatelyip,使其设置为method
nmcli connection add ipv4.addresses 192.168.38.128 ipv4.gateway 192.168.38.2 ipv4.dns 8.8.8.8 ipv4.method
nmcli connection add ipv4.addresses 192.168.38.130 ipv4.gateway 192.168.38.2 ipv4.dns 8.8.8.8 ipv4.method
nmcli connection add ipv4.addresses 192.168.38.132 ipv4.gateway 192.168.38.2 ipv4.dns 8.8.8.8 ipv4.method
Set the hostname for each of the three machines
hostnamectl set-hostname server.example.com
hostnamectl set-hostname node1.example.com
hostnamectl set-hostname node2.example.com
配置主机名和IP地址的映射关系
Enter the following codes on each of the three machines
[[email protected] ~]# echo "192.168.38.128 server.example.com" >> /etc/hosts
[[email protected] ~]# echo "192.168.38.130 node2.example.com" >> /etc/hosts
[[email protected] ~]# echo "192.168.38.132 node1.example.com" >> /etc/hosts
Then go to configure password-free login
Password-free login is allowedserverThis machine can log in to other machines without password
First generate the key
[[email protected] ~]# ssh-keygen -t rsa
Then pass the public key to the remaining two machines
ssh-copy-id [email protected]
ssh-copy-id [email protected]
At this point, you can log in without a password,测试如下
[[email protected] ~]# ssh [email protected]
Activate the web console with: systemctl enable --now cockpit.socket
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Tue Aug 2 16:41:14 2022 from 192.168.38.128
[[email protected] ~]#
[[email protected] ~]# ssh [email protected]
Activate the web console with: systemctl enable --now cockpit.socket
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Tue Aug 2 16:41:14 2022 from 192.168.38.128
[[email protected] ~]#
配置yum源使用Centos-stream.repo
我们需要将Centos-stream.repo下载到/etc/yum.repos.d/上
首先将原有的Centos-vault-8.5.2111.repoAdding a suffix will not take effect at this time
mv Centos-vault-8.5.2111.repo Centos-vault-8.5.2111.repo.bak
然后将windows上的传入linux
C:\Users\Chen Zhixing>sftp [email protected]
[email protected]'s password:
Connected to 192.168.38.128.
sftp> put D:\CentOS-Stream.repo /etc/yum.repos.d/
Uploading D:/CentOS-Stream.repo to /etc/yum.repos.d/CentOS-Stream.repo
D:/CentOS-Stream.repo 100% 1215 1.2MB/s 00:00
sftp>
安装ansible
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
第二步安装
https://mirrors.tuna.tsinghua.edu.cn/epel/epel-release-latest-8.noarch.rpm
yum install https://mirrors.tuna.tsinghua.edu.cn/epel/epel-release-latest-8.noarch.rpm
最后一步就是安装ansible
yum install ansible -y
使用ansible --version去验证
配置清单:
[node]
node1.example.com
node2.example.com
使用ansible node -m ping去验证
vim /etc/ansible/hosts
It is now complete to verify
边栏推荐
猜你喜欢
随机推荐
Haproxy服务监控
Navicat 解决隔一段时间不操作出现延时卡顿问题
pta a.1030的dijkstra+DFS方法
2017-06-11 Padavan 完美适配newifi mini【adbyby+SS+KP ...】youku L1 /小米mini
icebreaker的垃圾话学习指南
网卡软中断过高问题优化总结
Go (一) 基础部分2 -- if条件判断,for循环语句
VSO Downloader Ultimate 5.0.1.45 中文多语免费版 在线视频下载工具
浏览器多线程离屏渲染压缩打包方案
`monorepo` 中 `hoist` 机制导致加载配置文件路径的变化
令人愉快的 Nuxt3 教程 (一): 应用的创建与配置
ss-1.curl (cloud-provider-payment8001)
Modelarts第一次培训
7.24[C语言零基础 知识点总结]
vivado遇到的问题
令人愉快的 Nuxt3 教程 (二): 快速轻松地搭建博客
-元素之和-
7.8(6)
【转】最小描述长度准则MDL(Minimun Description Length)
陆运信息系统——班列项目总结(一)