Installation Guide 安装指南

Installation Guide 安装指南:


欢迎来到Ansibe 安装指南:


Basics / 什么会被安装

Ansible 默认情况下 管理机器通过SSH 协议 

一旦Ansible 被安装, 它不会添加一个数据库, 没有daemos 来启动和保持运行。

你只需要安装它在一个机器上(这台机器可以是一个笔记本电脑),

它可以从中心点管理整个远程机器群。

当Ansible 管理远程机器

选择什么版本?

因为他很容易从源代码运行,不需要在远程机器上安装任何软件,

很多用户会实际上跟踪开发版本。

Ansible的发布周期通常为4个月左右, 由于这么短的发布周期。


如果你是希望运行最新的发布版本  我们建议使用OS 包管理器 

对于其他安装选项,我们推荐通过pip安装 

Control Machine Requirements 控制机器要求:

目前ansible 可以从安装了Python 2(2.6或者2.7)版本 或者python 3 上任何机器运行

对于控制机器 Windows 不支持

这个包括 Red Hat, Debian, CentOS, OS X, any of the BSDs,


注意:

Managed Node Requirements  被管理节点需求

在一个被管理节点, 你需要一种通信方式, 通常是SSH。

默认这个使用sftp. 如果这个不可用,你可以切换到scp  

注意:

如果你在远程主机上启用了SELinux,你需要安装libselinux-python 在你使用任何  copy/file/template 相关的功能

你可以使用yum 模块或者 dnf 模块在Ansible 来安装这个模块在远程系统上

2.

By default, Ansible uses the python interpreter located at /usr/bin/python to run its modules. However, some Linux distributions may only have a Python 3 interpreter installed to /usr/bin/python3 by default. 

On those systems, you may see an error like:


默认情况下,Ansible 使用python 解释器位于/usr/bin/python来运行它的模块,


你也可以设置ansible_python_interpreter 变量来指明你的解释器或者你可以 安装 

一个Python 交互器用于模块使用 

你仍旧需要设置ansible_python_interpreter 如果 Python 2解释器没有安装 

Ansible's raw 模块(用于快速和脏的方式执行命令),script module 甚至不需要安装python.

因此,从技术上将,你可以使用Ansible 来安装一个Python的兼容版本使用raw模块,

ansible myhost --sudo -m raw -a "yum install -y python2"

安装控制机器:

最新的版本通过DNF 或者YUM

最新版本通过pip:

Ansible 可以通过"pip"安装,Python 包管理器。  

如果'pip' 不可用在你的python版本里,你可以得到pip通过:

node2:/root#pip --version
pip 18.0 from /usr/local/python27/lib/python2.7/site-packages/pip-18.0-py2.7.egg/pip (python 2.7)
node2:/root#easy_install pip
Searching for pip
Best match: pip 18.0
Processing pip-18.0-py2.7.egg
pip 18.0 is already the active version in easy-install.pth
Installing pip script to /usr/local/python27/bin
Installing pip2.7 script to /usr/local/python27/bin
Installing pip2 script to /usr/local/python27/bin

Using /usr/local/python27/lib/python2.7/site-packages/pip-18.0-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
原文地址:https://www.cnblogs.com/hzcya1995/p/13349078.html