CentOS7的ansible安装

本文详细介绍了如何在CentOS7上安装Ansible,并配置阿里云YUM源,同时验证了Ansible的成功安装,包括Ansible版本检查及简单功能测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装CentOS7的ansible

首先配置yum源

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vim aliBase.repo

[base]
name=aliBase
baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=0

[aliEpel]
name=aliEpel
baseurl=https://mirrors.aliyun.com/epel/$releasever\Server/$basearch/
gpgcheck=0

[epel]
name=epel
baseurl=https://mirrors.aliyun.com/epel-archive/7/x86_64/
gpgcheck=0

安装ansible

[root@localhost ~]# yum -y install ansible

安装python

[root@localhost ~]# yum -y install python

检测是否安装成功

[root@localhost ~]# ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 28 2022, 15:30:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
[root@localhost ~]# ansible localhost -m ping
localhost | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}

至此,CentOS7的ansible安装及检验完成。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值