February 23, 2016, learn, analyze Ansible code Ansible is a tool for bulk deployment used in operations, which is itself a framework, specific deployment and architectural analysis, and the following article is good. Http://os.51cto.com/art/201409/451927_all.htm First analyze the main file ansible, and the
Tags: mariadb compiling and installing shell Automation Ansible Project PracticeIn the previous blog has been demonstrated, through scripting MySQL Universal binary installation, the following through the demonstration script to implement the source code compilation MARIADB Automation, in large-scale deployment of multiple mariadb, where the use of ansible to imp
writing modules, you should check ( )out the Ansible repository.If you want your module to work with a particular version, you should also switchto that version to ensure compatibility. The following commands will set you up todevelop modules for Ansible 1.3.0. Checking out the Ansible code gives you accessto a handy
Ansible to run the job in parallel, and its value will be the maximum time thatAnsible will wait for the command to complete. The value of poll indicates to Ansiblehow often to poll to check if the command has been completed.If you wanted to run updatedb across an entire cluster of machines, it might look likethe following code:- hosts: alltasks:- name: Install mlocateyum: name=mlocate state=installed- nam
http://blog.csdn.net/hail100/article/details/41285391This article is from the "Operation and maintenance Automation" blog, please make sure to keep this source http://shower.blog.51cto.com/4926872/1892219Ansible Source Code Analysis
in the Device List group. It allows us to access all the hosts we configured at the same time. This is a very powerful tool, this allows us to review each host in the group and apply the operation above.
----Name: Configure the databaseHosts: dbserversUser: rootTasks:-Name: Install mysqlYum: name = {item} state = installedWith_items:-Mysql-server-MySQL-python
-Name: Start mysqlService: name = mysqld state = started enabled = true
-Name: Create a user for all app serversWith_items: groups. appse
Ansible @ an efficient configuration management tool-Ansible configure management-translation (8), ansible-ansibleIf you do not have written authorization, do not repeat Chapter 4. Use of Ansible in large projects
RolesIf your playbooks start expanding beyond what includes can help you solve, or youstart gathering a l
host;
(2) no server: no server. Run the command directly during use;
(3) modules in any languages ages: modules can be developed in any language;
(4) yaml and not code: Use the yaml language to customize the playbook;
(5) ssh by default: Work Based on SSH;
(6) strong multi-tier solution: multi-level command can be implemented.
4> advantages of ansible
(1) Lightweight. You do not need to install the agent o
conclusions by reading the source code. Therefore, we hope that when reading this article, is based on a certain understanding of Ansible, at least some concepts of Ansible, such as inventory, module, playbooks, etc.
Ansible Module
The module is the minimum unit of Ansible
name, as in this example the Mysql,mysql command includes defaults, handlers, meta, tasks, Templates, VARs directory, respectively, corresponding to different functions, the names of these directories are Ansible the official definition of the good, can not be modified, the description of the directory function is shown in table 1. The default Ansible only handles the actions defined in the file name main.
If you do not have written authorization, do not reprint it.
Chapter 4 Use of ansible in large projects
New features in 1.3There are two features in Ansible 1.3 that were alluded to previously in the chapter.The first feature is the metadata roles. They allow you to specify that your roledepends on other roles. For example, if the application that you are deploying needsto send mail, your role could depend
Automated Batch Deployment Tool Ansible notes Ansible installation and inventory filesI. Introduction of AnsibleAnsible is an automated operation and maintenance Deployment tool, and Saltstack,pupet, and so on, Ansible does not adopt the C/s architecture, that is, there is no client and server points. This means that the installation of
Do not reprint advanced playbook without written permission
Finding files with variablesAll modules can take variables as part of their arguments by dereferencing themwith {{ and }} . You can use this to load a particular file based on a variable.For example, you might want to select a different config file for NRPE (a Nagioscheck daemon) based on the architecture in use. Here is how that would look:---#1- name: Configure NRPE for the right architecture#2hosts: ansibletest#3user: root#4tasks:#5
compatible distributions: $ sudo yum-y install ansible
Ubuntu, Debian, and compatible distributions: $ apt-get Install ansible
Installing Ansible with PIPYou have previously described using PIP to install Ansible. Note that if you use Pip to install Ansible. When u
User [[[emailprotected] ~]# ansible abc-m shell-a ' grep mysql/etc/passwd ' 192.168.56.123 | FAILED | Rc=1 >>non-zero Return code ... Service module of the Ansible Common module to manage services on managed machines See if the VSFTP service on the managed machine starts [[emailprotected] ~]# ansible abc-m shell-a '
at/etc/ansible. find the position defined by CFG, the location specified by the-module-path parameter, the directory where the playbook file is located, and the directory where the role is located.
Let's create a playbook using the newly created module and put it under the library directory. The Code is as follows:
----Name: test the hostname FileHosts: tew.achineTasks:-Name: Set the hostnameHostname: Host
complete. The value of poll indicates to Ansiblehow often to poll to check if the command has been completed.If you wanted to run updatedb across an entire cluster of machines, it might look likethe following code:- hosts: alltasks:- name: Install mlocateyum: name=mlocate state=installed- name: Run updatedbcommand: /usr/bin/updatedbasync: 300poll: 10You will notice that when you run the previous example on more than five machines,the yum module acts
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.