Ansible Installation and introduction

Source: Internet
Author: User

Ansible uses a standard SSH connection to perform an automated process that does not require a proxy (other descriptions are self-searching)

This article system:

CentOS 6.5 x64

ip:172.16.162.129

Hostname:vm.lansgg.com

To test the client host:

CentOS 6.5 x64

ip:172.16.162.130

Hostname:vm1.lansgg.com


# # # # #摘自网友总结 #####

I. Introduction of Ansible

Ansible is an automated operations tools, based on the development of Python, the collection of many operations tools (puppet, Cfengine, Chef, func, fabric) The advantages of the implementation of batch system configuration, batch program deployment, batch Run command and other functions. Ansible is a module-based operation and does not have the capacity to deploy in bulk. The real batch deployment is the module that Ansible runs, and Ansible just provides a framework. Mainly include:

1, connection plug-in connection plugins: responsible for and be monitored to achieve communication;

2, Host Inventory: Specifies the operation of the master, is a configuration file inside the definition of monitoring host;

3, various module core module, command module, custom module;

4, through the use of plug-ins to complete log mail and other functions;

5. Playbook: When a script performs multiple tasks, it is not necessary to allow the node to run multiple tasks at once.

Second, ansible characteristics

1, no agents: do not need to be managed to install any client on the host;

2, no server: No servers, the use of direct command can be run;

3, modules in any languages: Based on module work, can use any language development module;

4, Yaml,not code: Use the Yaml language to customize the script playbook;

5, SSH By default: work based on SSH;

6, strong multi-tier solution: Multi-level command can be achieved.

Iii. Advantages of Ansible

1, lightweight, no need to install agent in the client, update, only need to make an update on the operating machine;

2, batch task execution can be written as script, and can be executed without distributing to remote;

3, the use of Python writing, maintenance more simple, ruby syntax is too complex;

4, support sudo.

Iv. working mechanism of ansible

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7B/57/wKiom1bMCA2yYx3OAAIPFhX0Hac238.png "title=" Ansible.png "alt=" Wkiom1bmca2yyx3oaaipfhx0hac238.png "/>

V. Installation of ansible

Dependent modules Paramiko, Pyyaml, JINJA2, Httplib2, Simplejson, Pycrypto, crypto2.6, PYASN1, Keyczar, Sshpass, etc.

Rpm-vhi python-yaml-3.09-3.el6.rf.x86_64.rpmrpm-vhi Python-jinja2-2.2.1-1.el6.rf.x86_64.rpmyum Install ansible

ansible Example:

First, connect this host to the test host SSH key

[[Email protected] ansible]# ssh-keygen -t rsagenerating public/private rsa  key pair. enter file in which to save the key  (/ROOT/.SSH/ID_RSA):  Enter  passphrase  (empty for no passphrase): enter same passphrase  Again: your identification has been saved in /root/.ssh/id_rsa. your public key has been saved in /root/.ssh/id_rsa.pub.the key  Fingerprint is:ae:b1:ef:46:d8:e4:3f:38:38:8d:8b:e7:e3:a2:4c:c2 [email protected]the key ' s  RANDOMART IMAGE IS:+--[ RSA 2048]----+|                  | |                  | |                  | |         .        | |        =s        | |.     &NBSP, .... +        | |. e.   .=.o       | |  + &NBSP, .... *+= o      | |   o. =*bo. .     |+-----------------+[[email protected] ansible]#  ssh-copy-id -i 172.16.162.130the authenticity of host  ' 172.16.162.130  ( 172.16.162.130) '  can ' t be established. rsa key fingerprint is 1e:76:f9:17:93:20:f1:be:06:48:02:3b:7c:80:41:07.are you  sure you want to continue connecting  (yes/no)?  yeswarning: permanently  added  ' 172.16.162.130 '   (RSA)  To the list of known hosts. Address 172.16.162.130 maps to localhost, but this does not map  back to the address - possible break-in attempt! [email protected] ' s password: now try logging into the machine,  with  "ssh  ' 172.16.162.130 '", and check in:  .ssh/authorized_keysto  Make sure we haven ' T added extra keys that you weren ' t  Expecting.

Conducting a command test

[Email protected] ansible]# ansible testhost-m ping172.16.162.130 | Success >> {"Changed": false, "ping": "Pong"}[[email protected] ansible]#

And Testhost is the representative of

[Email protected] ansible]# Pwd/etc/ansible[[email protected] ansible]# cat Hosts[testhost]172.16.162.130[[email Protected] ansible]#


Specific commands describe the following section





This article is from the "Big Wind" blog, please be sure to keep this source http://lansgg.blog.51cto.com/5675165/1744316

Ansible Installation and introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.