政策资讯

Policy Information


银河麒麟服务器v10 sp2安装ansible

来源: 重庆市软件正版化服务中心    |    时间: 2024-11-26    |    浏览量: 190    |   

一、安装ansible软件

1、通过yum源来安装

yum install ansible

2、查看安装的版本

ansible --version

3、配置主机组

Ansible工具默认主目录为/etc/ansible/,其中hosts文件为被管理机IP或者主机名列

二、配置免秘钥登录

1、管理主机上生成秘钥

ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
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:
73:80:07:fa:9a:0d:e0:0e:d1:c2:44:d2:d2:61:67:21 root@ansible
The key's randomart image is:
+--[ RSA 2048]----+
|o=E.+..          |
|=oo+ . o         |
|ooo . . o        |
| + . . . .       |
|. . . . S .      |
| o   =   o       |
|  . o .          |
|                 |
|                 |
+-----------------+

2、将管理机上生成的秘钥发送到被管理机

ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.207.137
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.207.132

3、测试是否配置成功

ansible -k all -m ping

评论

QQ咨询 扫一扫加入群聊,了解更多平台咨询
微信咨询 扫一扫加入群聊,了解更多平台咨询
意见反馈
立即提交
QQ咨询
微信咨询
意见反馈