Ansible (1), Ansible (
I. Introduction to Ansible
Ansible is a new automatic O & M tool developed based on Python. It integrates the advantages of many O & M tools (puppet, cfengine, chef, func, fabric, implements batch system configuration, batch program deployment, and batch running commands. You only need to install the ansible program on the management workstation to configure the IP address of the managed host. The controlled host has no client. Ansible works based on modules. ansible applications exist in epel (third-party community) Sources and rely on many python components. It mainly includes:
Ii. Ansible features
Iii. overall architecture
- Ansible core: ansible core Module
- Host inventory: host database, which defines a list of controllable hosts
- Connection plugins: connection plug-in. Generally, it is connected Based on the ssh protocol by default.
- Modules: core modules (built-in module) and custom modules (custom module)
- Playbooks: the script that completes the task arrangement according to the set sequence.
Iv. Installing Ansible
1. quick installation
Linux: If python-pip and python-devel are installed in the system, you can use pip to install ansible (assuming you have installed the Development kit Development Tools)
$ sudo pip install ansible
Fedora/RHEL/CentOS: You can use the yum management tool that comes with the system.
$ yum -y install ansible
Debian/Ubuntu: Use the apt management tool provided by the system
$ sudo apt-add-repository -y ppa:ansible/ansible$ sudo apt-get update$ sudo apt-get install -y ansible
2. Manual step-by-step Installation
(1) python2.7 Installation
# Wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz# tar xvzf Python-2.7.8.tgz # cd Python-2.7.8 #. /configure -- prefix =/usr/local # make -- jobs = 'grep processor/proc/cpuinfo | wc-l' # make install # copy the python header file to the standard directory, to avoid ansible compilation, you cannot find the required header file # cd/usr/local/include/python2.7 # cp-. /*/usr/local/include/
(2) install the setuptools Module
https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz# tar xvzf setuptools-7.0.tar.gz# cd setuptools-7.0# python setup.py install
(3) install the pycrypto Module
# wget https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz# tar xvzf pycrypto-2.6.1.tar.gz# cd pycrypto-2.6.1# python setup.py install
(4) install the PyYAML Module
http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz# tar xvzf yaml-0.1.5.tar.gz# cd yaml-0.1.5# ./configure --prefix=/usr/local# make --jobs=`grep processor/proc/cpuinfo | wc -l`# make installhttps://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz# tar xvzf PyYAML-3.11.tar.gz# cd PyYAML-3.11# python setup.py install
(5) Jinja2 module Installation
https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.9.3.tar.gz# tar xvzf MarkupSafe-0.9.3.tar.gz# cd MarkupSafe-0.9.3# python setup.py installhttps://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz# tar xvzf Jinja2-2.7.3.tar.gz# cd Jinja2-2.7.3# python setup.py install
(6) paramiko module Installation
https://pypi.python.org/packages/source/e/ecdsa/ecdsa-0.11.tar.gz# tar xvzf ecdsa-0.11.tar.gz# cd ecdsa-0.11# python setup.py installhttps://pypi.python.org/packages/source/p/paramiko/paramiko-1.15.1.tar.gz# tar xvzf paramiko-1.15.1.tar.gz# cd paramiko-1.15.1# python setup.py install
(7) simplejson module Installation
https://pypi.python.org/packages/source/s/simplejson/simplejson-3.6.5.tar.gz# tar xvzf simplejson-3.6.5.tar.gz# cd simplejson-3.6.5# python setup.py install
(8) ansible Installation
https://github.com/ansible/ansible/archive/v1.7.2.tar.gz# tar xvzf ansible-1.7.2.tar.gz# cd ansible-1.7.2# python setup.py install
# View ansible version # ansible -- versionansible 2.3.1.0 config file = configured module search path = Default w/o overrides python version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 20150623 (Red Hat 4.8.5-11)]