Perform a playbookThe above sections already have a preliminary understanding of Playbook's syntax, so how do you run a playbook?This is very simple, here's an example of running playbook in parallel, the level of parallelism is 10Ansible-playbook Playbook.yml-f 10Ansible-pull (pull configuration rather than push configuration)Can we turn the ansible architecture upside down so that the managed nodeDo check in to get configuration information instead
A description of the application scenarioNow I need to distribute Logstash new version of RPM package to 50+ number of servers, about 220MB, directly using ansible Copy command, the command is as follows:Ansible all-m copy-a "src=/opt/software/logstash/logstash-agent-2.3.3-fb.centos6.x86_64.rpm dest=/opt/software/ LogstashIn the process of implementation, soon received Zabbix network monitoring alarm, alarm project is instantaneous traffic change more
* Define MAIN.YML and call copy and install. Any directory must have a total entry profile main.ymlVim/etc/ansible/nginx_install/roles/install/tasks/main.yml #内容如下-Include:copy.yml-Include:install.ymlTo this two roles:common and install the definition is complete, next to define a program total Portal configuration file* Define INSTALL/INSTALL.YML Master Entry profile to invoke the secondary total configuration fileVim/etc/
Copy ModuleThe role of the copy module in Ansible is to copy the files on the ansible execution machine to the remote node.The reverse operation of the fetch module.Common module parameters
Name of parameter
whether you must
Default Value
Options
Description
Src
No
The absolute path is required to locate the files on the machine t
1. IntroductionAnsible 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
Used to play ansible, the root account is used to manage. Now to the production environment, can not be so casual, I believe that many other companies are also banned from the root SSH connection.Therefore, I have a problem with this deployment, many articles on the internet, are not elaborate on this piece. I also groping to do out, through this practice, but also further deepened the understanding of ansible
Recently encountered a problemSeport is isn't a legal parameter in an Ansible task or handlerThe reason is that my local Ansible Extra Modules is obsolete and needs to be updated. But the official document of Ansible only gives such a word.There should be no need to install this repo separately as it should being included in any
Solve the problem of slow access to the official ansible website.
Recently, I have been familiar with ansile many times, so I need to read the official website from time to time. However, the loading speed is really tough and super slow.1. Open the chrome developer Tool
It is found that this url needs to be stuck when it is obtained.
Request URL: http://www.google.com/cse/brand? Form = search-form-id i
I. Description of the EnvironmentServer with Ansible installed: 192.168.13.45Test environment server: 192.168.13.49/home/app/api-tomcat/webapps/api.war a new version of the war package location for the test environmentProduction Environment server: 192.168.13.51/home/app/api-tomcat/webapps/api.war for production Environment War package location/HOME/APP/API-TOMCAT/WEBAPPS/API for production environment Project location/home/app/tomcat.bak/ api/webapps
Because the project needs to use to the Ansible API, according to modify the official documents provided by the use of examples, after many tests, will be able to use the code to share to everyone, you just need to modify the code according to their own actual environment.Official Document: http://docs.ansible.com/ansible/latest/dev_guide/developing_api.html#python-api-2-0#coding:utf-8importjsonfromcollecti
Demand:Remotely installs Vcredist 2008, 2010, 2012, and 20,134 versions on Windows Server R2.First in the official documents of the ansible to find out if there is a suitable module directly can be used.The first thing to find is the Win_package module: http://docs.ansible.com/ansible/win_package_module.html , and see the example it gives.650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif
1. Configuring the Jenkins EnvironmentCommand refer to the previous article "Docker Build Jenkin". Single-Machine deployment. In this example. Jenkins,ansible installed on the same machine.Jenkins needs to configure/etc/sudoers. Also need to give/bin/bash, as well as Jenkins's home directory under. SSH requires a copy of the ansible SSH private key1. Configure/etc/sudoersRoot all=(All) all# add jen
Ansible's script is written in the Yaml language, with the following basic syntax:
Basic syntax:1. Case2, the same level to be aligned, indentation representation level3, indentation is not allowed to use the TAB key4, the indentation of the number of spaces does not stipulate that the same element can be distinguished
Supported Data Structures:1. Object: A set of key-value pairs, also known as a map/hash/dictionaryExample: Name:example key: Value2, array: A set of
Ansible series (5): PlaybookBefore playbook
After the first two modules, I believe that anyone who uses shell will discover the power of ansible.
Here we will introduce playbook, a truly powerful place. Let you get rid of the difficulty of executing shell.Definition of Playbook
The definition of Playbook is difficult to describe accurately in Chinese. Reference the official website:
Playbooks are Ansible'
Ansible InstallationInstall Epel as a yum source for installing ansible (CentOS6.4):RPM-UVH http://ftp.linux.ncsu.edu/pub/epel/6/i386/epel-release-6-8.noarch.rpmInstall Ansible:Yum Install ansible-yConfiguration file:Path:/etc/ansible/hostsConfiguration Description: Webservers is the group name, and the following IP or
should include at least one file named Main.yml that defines the task list for this role, which you can use include to include other task files that are located in this directory;Files directory: A file that is called by a module such as copy or script;Templates Directory: Template module will automatically look for JINJA2 templates files in this directory;Handlers directory: This directory should contain a MAIN.YML file that defines the handler used for this role, and the other handler files t
YAML syntaxThis article is from: http://www.ansible.com.cn/docs/YAMLSyntax.htmlThis page provides a basic overview of the correct YAML syntax, which is used to describe a playbooks (our Configuration management language).We use YAML because it is like XML or JSON as a data format that facilitates people's reading and writing. In addition, there are libraries that use YAML in most languages.You may want to read how playbooks is used in practice.Basic YAMLFor
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.