This article source: http://sofar.blog.51cto.com/353572/1579894/ObjectiveA powerful configuration management solution written by Python. Although there are already many alternative configuration management solutions available, they have advantages and disadvantages, and ansible is characterized by its simplicity. One thing that makes Ansible unique in the mainstream configuration management system is that i
AnsiblePython-based Paramiko development, distributed, no client-side, lightweight, configuration syntax using Ymal and JINJA2Template language, stronger remote command to perform operationsAnsible working mechanismAnsible the Ansible module via the SSH protocol (or Kerberos, LDAP) on the management nodeLine, automatically delete after execution, can use SVN to manage the custom module and orchestrationFive componentsAnsible: CoreModules: Core modules
Tags: Automated ansible
Ansible is an open-source automated O M tool that neither requires a database nor runs background programs (daemons)
Easy to use, relatively simple compared with other similar tools (such as puppet)
I. Control Machine requirements:
The requirements for the ansible control machine are extremely simple. You can install Python or a later ve
The fetch module is the same as the copy function, which is the file transfer between different machines, the former is pulling files from the node to the master machine (the machine with ansible), the latter is transferring files from the master to the node. The template module can insert variables into the copied file.(Official document) the Copy module copies a file on the local box to remote locations. Use the Fetch module to copy files from remot
Install: Dependent packages: A jinja2:python of the designer-friendly modern template language Pyyaml:python a YAML encoding/deserialization function library Paramiko: SSHv2 written in pure Python Protocol function Library HTTPLIB2: A full-featured HTTP client function library installation Ansible[[emailprotected]~]#yumlist|grep-i ansibleFailedtosetlocale,defaultingtoCansible.noarch 1.9.2-1.el6 epelansible-inventory-grapher.noa
Ansible-Bulk Linux management tools"Ansible is easy it Automation"--simple automated IT tools.
Batch execution of commands on a remote server
Automating the deployment of apps
Automation Management Configuration Items
Automated Cloud service Management
Install (Ubuntu)Rely on SSH and python
Apt-get Install Ansible
Co
Tag: Equals line chown Package date file Service Playbook Word1.1 Synchronizing the MySQL package to the client server for pre-installationPs:mysql Install the package line to the/ansible/roles/mysql/files directory on the ansible server vim/ansible/roles/mysql/tasks/main.yml
- name:copy mysql_tar_gz to client
copy:src= mysql-5.6. tar.gz dest=/tmp/mysql-5.6.
Requirements:Batch Modify the server's account (assuming root account) password, with a randomly generated string to do the password
Environment:Assume that the target group for the server in the/etc/ansible/hosts file is as follows
[Target-servers]
192.168.0.[1:100]
Perform Actions
1 generate random strings for candidate password characters on each remote server using the OpenSSL rand command
Ansible tar
Ansible Installing Nginx* Idea: First on a machine to compile and install the Nginx, packaging, and then use Ansible to the issued1./usr/local/nginx/is an nginx file that has been compiled and installed, and the startup scripts and configuration files are configured.2.cd/usr/local #进入上一级目录3.tar CZVF nginx.tar.gz Nginx #将目录打包4.cd/etc/ansible entering the
. years 4 Month - Day9:12First, the basic structureAnsible #Ansible-doc # View HelpAnsible-playbook # Execution PlaybookAnsible-pull #Ansible-galaxy #Ansible-vault #Second, configuration structureAnsible.cfg # configuration filehosts #inventory configuration fileRole # Role Directory1 , see all the modules you can use ansibl
Automated operations Tools: ansible
Application scenario for multi-process call Ansible API: Application System Check
An application system may have a cluster of 20-50 servers, and a preliminary system-level check can be checked with a unified playbook, such as (Df-h command). But deep into the application layer, there are some personalized applications, such as 2 HTTP servers, 20 middleware
The CMDB crawls service information in many ways, using automated tools Saltstack, Ansible, puppet, or using other modules to directly SSH remote connections to fetch server information. Here is a record of using the Ansible API interface to invoke the Setup module fetch.Experiment using two machines
Ip
System
Software
192.168.93.137
Centos6.5_x64
First, what kind of situation requires batch deployment1, the operating system installationThe Common collber,red hat satelite (Redhat) system is dedicated.2, the operating system configurationIt is common to have cfengine,puppet,chef,func. One of the most popular puppet3, the deployment of bulk programs4. Run the batch command to view status informationIi. introduction of AnsibleThe architecture of the ansible is roughly as follows650) this.width=650
I. Introduction of AnsibleAnsible is a new automated operation tools, based on Python development, the collection of a number of 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
shell:sleep async:10 621720484791.102116> finished on Localhostplay RECAP ************************* poll is set to 0, which means that the step execution succeeds without waiting for execution results Example 3:----Name:test hosts:localhost tasks: -Name:wair for shell:sleep async:0 poll:10 results: # TI Me ansible-playbook xiama.yml TASK: [Wair for] **************************************************************
Although I do not want to use the word "should", but it is still written, and indeed I myself now so understand.So this understanding is that a key point of ansible is the total one playbook is to rely on a lot of elements, like in the beginning of that picture, such asIt's all about it. Whether it is a yml file or a Jinja2 file, the inside of these files must be closely related to ansible, and the reason w
http://sofar.blog.51cto.com/353572/1579894first do password-free login, there are several machines on the SCP several times the public keySsh-keygen-T Rsa-p"'SCPId_rsa.pub192.168.2.84:/root/.SSH/Authorized_keys[[email protected]084-Monitor ansible]# bash Ansib[[email protected]084-monitor ansible]#CatAnsibwget--no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gzTa
Asible is a very good tool in the operation of tools, I personally prefer, can be flexibly configured according to the needs of yml files to achieve different business needs, because do not need to install the client, the start is very easy, In some cases you might want to write ansible as a library component of Python into your own script, and today's script script will show how ansible can be combined wit
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.