当前位置:网站首页>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"
}
边栏推荐
- 开关、电机、断路器、电热偶、电表接线图大全
- Informatics Olympiad All-in-One (1259: [Example 9.3] Find the longest non-descending sequence)
- 源码构建LAMP环境-3
- 以赛促练-力扣第304场周赛反思(持续更新中)
- 源码构建LAMP环境-2
- 「每周译Go」这次我们来点不一样的!--《How to Code in Go》系列上线
- PyRosetta 安装方法之Conda安装
- Xcode13.1运行工程报错fatal error: ‘IFlyMSC/IFly.h‘ file not found的问题
- 模糊查询like用法实例(Bee)
- 【目标检测】YOLOv5:640与1280分辨率效果对比
猜你喜欢
The software testing process specification is what?Specific what to do?
Zabbix 5.0 监控教程(二)
A brief discussion on the transformation of .NET legacy applications
Flink Yarn Per Job - 启动AM
Use the TCP protocol, we won't lost package?
Informatics orsay a tong (1258: 【 9.2 】 digital pyramid)
VisualStudio 制作Dynamic Link Library动态链接库文件
【模型压缩】实例分析量化原理
HCIP--路由策略实验
源码构建LAMP环境-2
随机推荐
回文自动机+CodeTON Round 2 C,D
sre成长之路
[21 Days Learning Challenge] Bubble Sort and Insertion Sort
Use the TCP protocol, we won't lost package?
2022年金九银十,Android面试中高频必问的问题汇总
管理工具|宝藏书签收藏管理工具
模糊查询like用法实例(Bee)
js: 实现一个cached缓存函数计算结果
PLC工作原理动画
HCIP--路由策略实验
李沐动手学深度学习V2-bert和代码实现
Informatics Olympiad All-in-One (1259: [Example 9.3] Find the longest non-descending sequence)
《分布式微服务电商》专题(一)-项目简介
接口测试常用工具及测试方法(入门篇)
YOLOv5+BiSeNet——同时进行目标检测和语义分割
什么是幂等
ACE JET NPOI
golang刷leetcode:统计区间中的整数数目
如何成为一名正义黑客?你应该学习什么?
开关、电机、断路器、电热偶、电表接线图大全