CenOS8安装ansible
Posted 晦暗留给过往
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CenOS8安装ansible相关的知识,希望对你有一定的参考价值。
CentOS 8 安装 ansible
1.确认OS信息和网络连通性
2.确认自己的yum仓库配置
3.安装ansible
`1.确认OS信息和网络连通性
[root@wxy ~]# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)
[root@wxy ~]#
[root@wxy ~]# ping baidu.com -c 2
PING baidu.com (220.181.38.251) 56(84) bytes of data.
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=1 ttl=128 time=8.01 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=2 ttl=128 time=10.0 ms
--- baidu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 3ms
rtt min/avg/max/mdev = 8.010/9.007/10.004/0.997 ms
[root@wxy ~]#
`2.确认自己的yum仓库配置
#挂载本地镜像到iso目录下
[root@wxy ~]# mkdir /iso
[root@wxy ~]# mount /dev/sr0 /iso/
mount: /iso: WARNING: device write-protected, mounted read-only.
[root@wxy ~]#
#配置本地软件仓库,和epel仓库
[root@wxy ~]# cat /etc/yum.repos.d/iso.repo
#本地Base仓库
[Cenos-base]
name=base-repo
gpgcheck=0
enable=yes
baseurl=file:///iso/BaseOS
#本地AppStream
[centos-appstream]
name=stream-repo
gpgcheck=0
enable=yes
baseurl=file:///iso/AppStream
#epel的仓库(想下载epel必须要有这个仓库)
[extras]
name=centos-extras
gpgcheck=0
enable=yes
baseurl=https://mirrors.aliyun.com/centos/8/extras/x86_64/os
#确认仓库配置成功
[root@wxy ~]# yum repolist
Last metadata expiration check: 0:04:54 ago on Tue 03 May 2022 01:33:44 AM EDT.
repo id repo name status
Cenos-base base-repo 1,655
centos-appstream stream-repo 4,681
extras centos-extras 39
[root@wxy ~]#
`安装ansible
如果在centos 安装 ansible,第一种 是源码安装 ,第二种 是通过 epel软件仓库安装
#下载epel软件仓库,epel安装完成之后会自动帮你生成epel的软件仓库
[root@wxy ~]# yum install epel-release -y
[root@wxy ~]# yum repolist
Last metadata expiration check: 0:04:54 ago on Tue 03 May 2022 01:33:44 AM EDT.
repo id repo name status
Cenos-base base-repo 1,655
centos-appstream stream-repo 4,681
*epel Extra Packages for Enterprise Linux 8 - x86_64 8,534
*epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64 0
extras centos-extras 39
[root@wxy ~]#
#安装ansible
[root@wxy ~]# yum install ansible -y
[root@wxy ~]# 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, May 21 2019, 23:51:36) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]
[root@wxy ~]#
以上是关于CenOS8安装ansible的主要内容,如果未能解决你的问题,请参考以下文章
ansible的安装与介绍host-pattern格式ansible的command模块ansible的shell模块ansible的script模块ansible的copy模块