当前位置:网站首页>ansible的安装

ansible的安装

2022-11-24 21:38:51Jeff657

配置yum源(采用网络源,下面是搜索阿里云的镜像)

[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] 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:

[[email protected] ~]# yum -y install ansible

若安装不成功,则升级python的版本(看报错信息,查看需要python几)

[[email protected] ~]# yum -y install python

检测是否安装成功:

[[email protected] ~]# ansible --version
ansible 2.8.0
  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)]
  
[[email protected] ~]# ansible localhost -m ping
localhost | SUCCESS => {
    
    "changed": false,
    "ping": "pong"
}

原网站

版权声明
本文为[Jeff657]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_56105279/article/details/128016957

随机推荐