安装ansible

本文将指导您在CentOS操作系统上安装自动化工具Ansible,通过简单的步骤快速掌握安装过程,为您的IT基础设施管理提供便利。

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

[root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2495  100  2495    0     0   8234      0 --:--:-- --:--:-- --:--:--  8234
[root@localhost yum.repos.d]# ls
CentOS-Base.repo
[root@localhost yum.repos.d]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost yum.repos.d]# dnf clean all
25 files removed
[root@localhost yum.repos.d]# dnf list all|grep ansible
ansible-collection-microsoft-sql.noarch                1.1.0-1.el8                                                AppStream        
ansible-collection-redhat-rhel_mgmt.noarch             1.0.0-2.el8                                                AppStream        
ansible-freeipa.noarch                                 0.3.8-1.el8                                                AppStream        
ansible-freeipa-tests.noarch                           0.3.8-1.el8                                                AppStream        
ansible-pcp.noarch                                     2.2.1-1.el8                                                AppStream        
centos-release-ansible-29.noarch                       1-2.el8                                                    extras           
[root@localhost yum.repos.d]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
[root@localhost yum.repos.d]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
[root@localhost ~]# dnf makecache
CentOS-8.5.2111 - Base - mirrors.aliyun.com           17 kB/s | 3.9 kB     00:00    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com         12 kB/s | 1.5 kB     00:00    
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com      29 kB/s | 4.3 kB     00:00    
Metadata cache created.
[root@localhost ~]# yum -y install centos-release-ansible-29
[root@localhost ~]# yum -y install ansible
[root@localhost ~]# ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Jan 19 2022, 23:28:49) [GCC 8.5.0 20210514 (Red Hat 8.5.0-7)]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值