当前位置:网站首页>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 rsaThen 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
边栏推荐
猜你喜欢
随机推荐
斐讯K2路由编译Padavan华硕固件和心得
3588. 排列与二进制
Djiango第二次培训
动态调整web系统主题? 看这一篇就够了
浏览器中的 preview 和 response 的值不一致
Makefile语法
取某一区间中素数的个数--洛谷P1865 A % B Problem
`monorepo` 中 `hoist` 机制导致加载配置文件路径的变化
MySQL 索引检索原理和B+Tree数据结构详解
动态规划笔记
VSO Downloader Ultimate 5.0.1.45 中文多语免费版 在线视频下载工具
图的最短路径的核心——松弛技术
轨迹(形状)相似性判断与度量方法
pta a.1030的dijkstra+DFS方法
-寻找鞍点-
Newifi路由器第三方固件玩机教程,这个路由比你想的更强大以及智能_Newifi y1刷机_smzdm
UPC-Longest X
web安全-SSTI模板注入漏洞
jsp通过form表单提交数据到servlet报404
第四次培训








