当前位置:网站首页>Ansible安装与配置
Ansible安装与配置
2022-08-02 20:54:00 【m0_59138290】
准备三台机器:
server.example.com
node1.example.com
node2.example.com
配置IP,主机名,/etc/hosts
主机server.example.com
[[email protected] ~]# hostnamectl set-hostname server.example.com
[[email protected] ~]# vim /etc/hosts
添加:
192.168.255.128 server.example.com
192.168.255.129 node1.example.com
192.168.255.130 node2.example.com
主机node1.example.com
[[email protected] ~]# hostnamectl set-hostname node1.example.com
[[email protected] ~]# vim /etc/hosts
添加:
192.168.255.129 node1.example.com
主机node2.example.com
[[email protected] ~]# hostnamectl set-hostname node2.example.com
[[email protected] ~]# vim /etc/hosts
添加:
192.168.255.130 node2.example.com
配置免密登录
[[email protected] ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:4L478U+nKiIdniujLwyZx/uwzc53BI/LfkmiS4P6ydU [email protected]
The key's randomart image is:
[[email protected] ~]# cd ~/.ssh/
[[email protected] .ssh]# ssh-copy-id [email protected]
配置yum源使用Centos-stream.repo
将Centos-stream.repo文件上传到/etc/yum.repos.d/
安装ansible
yum install ansible -y
使用ansible --version去验证
[[email protected] yum.repos.d]# ansible --version
配置清单:/etc/ansible/hosts
[node]
node1.example.com
node2.example.com
使用ansible node -m ping去验证
[[email protected] .ssh]# ansible node1.example.com -m ping
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller
starting with Ansible 2.12. Current version: 3.6.8 (default, Sep 9 2021, 07:49:02)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]. This feature will be removed from ansible-
core in version 2.12. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
/usr/local/lib/python3.6/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
from cryptography.exceptions import InvalidSignature
node1.example.com | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"changed": false,
"ping": "pong"
}
边栏推荐
- golang刷leetcode:按位与结果大于零的最长组合
- 信息学奥赛一本通(1260:【例9.4】拦截导弹(Noip1999))
- 如何使用windbg查看C#某个线程的栈大小 ?
- Informatics Olympiad All-in-One (1257: Knight Moves)
- PyRosetta 安装方法之Conda安装
- 无线振弦采集仪远程修改参数的方式
- 开关、电机、断路器、电热偶、电表接线图大全
- Details in C# you don't know
- 源码构建LAMP环境-2
- A brief discussion on the transformation of .NET legacy applications
猜你喜欢

"Weekly Translate Go" This time we have something different!-- "How to Code in Go" series launched

供电系统电气图

【流媒体】推流与拉流简介

HCIP--路由策略实验

Day35 LeetCode
包管理工具npm- node package management相关知识 、检查包更新、NPM包上传、更换镜像、npm ERR! registry error parsing json

Wiring diagrams of switches, motors, circuit breakers, thermocouples, and meters

总结嵌入式C语言难点(2部分)

JMeter的基本使用

A brief discussion on the transformation of .NET legacy applications
随机推荐
golang 刷leetcode:祖玛游戏
vscode如何能将输出从OUTPUT改为TERMINAL或者DebugConsole
汇编语言中b和bl关键字的区别
js如何获取浏览器缩放比例
李沐动手学深度学习V2-bert预训练数据集和代码实现
【21天学习挑战赛】冒泡排序与插入排序
Tencent YunMeng every jie: I experienced by cloud native authors efficiency best practices case
正则表达式
供电系统电气图
golang刷leetcode:最大波动的子字符串
包管理工具Chocolate - Win10如何安装Chocolate工具、快速上手、进阶用法
[C题目]力扣138. 复制带随机指针的链表
ALV concept explanation
golang刷leetcode:我能赢吗
引用类型 ,值类型 ,小坑。
golang刷letcode:公司命名
人尽皆知的云原生,到底是大势所趋还是过度炒作?
Common tools and test methods for interface testing (Introduction)
ECCV 2022 | ByteTrack: 简单高效的数据关联方法
Day35 LeetCode