3.2.Ansible安装

在开始安装之前,为了避免firewalld和selinux的干扰,我们将其关闭。该操作仅限于实验环境,请勿在生产环境操作

  • 关闭firewalld防火墙

    $ systemctl stop firewalld
    $ systemctl disable firewalld
  • 关闭selinux

    # 编辑配置,将SELINUX设置为disable
    $ vi /etc/sysconfig/selinux
    SELINUX=disabled
    # 重启虚机,使配置生效
    $ reboot
    # 重启成功后,执行如下命令,若返回Disabled则说明成功关闭SELINUX
    $ getenforce
    Disabled

Ansible的常见安装模式(CentOS7)

Yum包管理安装

# yum install epel-release
# yum repolist
# yum -y install ansible

python3+pip3+virtualenv安装

  1. 安装python3

  2. 安装virtualenv

  3. 创建python3虚拟空间并激活

  4. 安装ansible

  5. 验证ansible版本

Python3.6+Ansible2.5源代码安装

  1. 预先安装Python3.6版本

  2. 安装virtualenv

  3. 创建Ansible账户并安装python3.6版本virtualenv实例

  4. Git源代码安装ansible2.5

  5. 加载python3.6 virtualenv环境

  6. 安装ansible依赖包

  7. 在python3.6虚拟环境下加载ansible2.5

  8. 验证ansible2.5

更多安装方式

更多安装方式请见:Installation Guidearrow-up-right

Last updated