Ansible offline installation

Ansible offline installation

Installation Environment

CentOS7.6,Python2.7.5,Ansible2.7.10

1, Ansible Description:
  Ansible is a Python-based open source automation tools developed to achieve a batch run commands, batch deployment, bulk configuration system and other functions. Remote commands default SSH protocol (other protocols may also be used), or perform configuration issued without deploying any client agent software (Agentless) control on the host, and supports multiple hosts managed in parallel. Ansible is based on the work of the module, does not have the ability to deploy the batch, volume deployment is truly module Ansible running, Ansible only provides a framework.
Ansible 2.7 official help documentation: HTTPS: //docs.ansible.com/ansible/latest/index.html
Ansible Chinese guide: HTTP: //www.ansible.com.cn/index.html
2, version selection:
  if you want to using the latest version of Ansible, and the operating system you are using a package manager RHEL, CentOS, Fedora, Debian, Ubuntu, recommend the use of the system.
3, the host of management requirements:
  Currently, as long as the installation of Python 2.6 or Python 2.7 on the machine (windows do not control the host system), can run Ansible.
  The host system can be a variety of versions of Red Hat, Debian, CentOS, OS X, BSD , and so on.
4, the managed node requirements:
  We usually use ssh to communicate with the managed node, the default use sftp. If sftp unavailable, may be configured in a manner scp ansible.cfg profile. On the managed node you need to install version 2.4 or Python. If the version is less than Python 2.5, still you need to install a module: python-simplejson

In an enterprise environment, the server installation ansible often can not access the Internet, simply download the source code ansible installation, will encounter a variety of missing dependencies problem, therefore, recommended making the source yum, yum install and use the ansible.

Download the offline installation package

1, the same OS prepare a server can connect to the Internet using yumdownloader Download ansible installation package and all dependencies.
Yumdownloader installation tool as root:
# yum install yum-utils

ScreenShot209.jpg
Create offline installation package download folder:

# mkdir /root/mypackages

Download yum install ansible required fedora epel source:

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

ScreenShot210.jpg
Download ansible and all dependencies:

# yumdownloader --resolve --destdir /root/mypackages/ ansible

ScreenShot211.jpg

2, download all of the above rpm installation package (/ root / mypackages) package, upload it to the enterprise server environment, to extract the files needed to create yum source folder.

# tar czvf ansible.tar.gz mypackages/    #打包下载的rpm包

Copy to the enterprise server environment through U disk or network.

ansible installation

1, to configure the local CentOS7.6 yum Source:

# mount /dev/cdrom /mnt
# cp -r /mnt centos76
# cd /etc/yum.repos.d
# mkdir bak
# mv CentOS-* bak
# vi /etc/yum.repos.d/centos76.repo
[centos76]
name=centos76
baseurl=file:///root/centos76
gpgcheck=0
enabled=1

Test local centos7.6 yum source:

# yum update
# yum install vim lrzsz bash-completion

2, the installation package to upload ansible yum source:

# rz    #通过U盘拷贝的,上传打包的rpm文件到服务器
# tar zxvf ansible.tar.gz
# mv mypackages/* /root/centos76/Packages/    #剪切rpm文件到已创建的centos源文件夹
# yum install createrepo
# yum clean all
# createrepo /root/centos76    #生成新的yum仓库
# yum update
# yum repolist
# yum list|grep ansible    #查看yum源是否已有ansible安装包

3, installation ansible:

# yum install ansible

ScreenShot400.jpg

# ansible --version    #验证安装成功,查看版本号

ScreenShot399.jpg
Note: If you do not want to create centos source, you can download only the ansible and createrepo installation package, create yum source can be installed in accordance with the same method.

# yumdownloader --resolve --destdir /root/mypackages/ createrepo

Note: Online installation is relatively simple, after installing epel-release package, the following command can be run directly

# yum install ansible
或者使用pip安装:
# pip install ansible

Guess you like

Origin www.cnblogs.com/ipoke/p/11325311.html