Ansible环境搭建

作者: 四冶读史 | 来源:发表于2017-09-13 10:07 被阅读111次

    1.概述

    官网提供了不同环境的安装方式,可以根据自己的具体情况,选择不同安装方式。鉴于ansible是通过python开放的,我就选则通过pip来安装。

    2.安装依赖

    检查环境依赖,如果没有则需要安装,不然在安装ansible时会报错

    yum -y install gcc python-devel openssl-devel
    

    2.安装pip

    检查下环境是否已安装有pip,如果没有,可通过如下方式安装

    sudo easy_install pip
    

    3.安装ansible

    sudo pip install ansible
    

    4.配置ansible

    ansible的一些的设置可以通过配置文件完成。在大多数场景下默认的配置就能满足大多数用户的需求,在一些特殊场景下,用户还是需要自行修改这些配置文件。如果安装过程中没有ansible.cfg文件,可以自己创建。
    系统读取配置文件的顺序:

    * ANSIBLE_CONFIG (an environment variable)
    * ansible.cfg (in the current directory)
    * .ansible.cfg (in the home directory)
    * /etc/ansible/ansible.cfg
    

    版本1.5之前的读取顺序如下:

    * ansible.cfg (in the current directory)
    * ANSIBLE_CONFIG (an environment variable)
    * .ansible.cfg (in the home directory)
    * /etc/ansible/ansible.cfg
    

    创建配置文件

    mkdir -p /etc/ansible
    vi /etc/ansible/ansible.cfg
    

    最新配置文件:https://raw.githubusercontent.com/ansible/ansible/devel/examples/ansible.cfg
    根据需要,可以调整参数。

    参考地址:
    ansible安装http://docs.ansible.com/ansible/latest/intro_installation.html
    ansible配置http://docs.ansible.com/ansible/latest/intro_configuration.html

    相关文章

      网友评论

        本文标题:Ansible环境搭建

        本文链接:https://www.haomeiwen.com/subject/qldksxtx.html