Playbook1 Playbook is a list consisting of one or more "play"The main function of 2 play is to dress up a pre-merged host into a role defined in advance by a task in ansible. Fundamentally, the so-called task is nothing more than a module that calls Ansible. Organize multiple play in a single playbook, which allows the
Preface
Two previous articles talk about ansible deployment and use of ansible modules respectively. They have an initial understanding of ansible. This article focuses on introducing playbook.For details about ansible deployment, click ansible first: DeploymentAnsible modul
Ansible is a lightweight batch configuration management tool for agentless, because of the relatively late (13) development based on ansible less relevant documents, so here are some small experiments, combined with the existing data and source code, explore the Ansible two times development.The contents of the essay are divided into three parts.
The previous article introduced the installation configuration and example of Ansible: http://msiyuetian.blog.51cto.com/8637744/1748143The following article mainly introduces Ansible's playbook, playbook is equivalent to the module or function written into the configuration file, and then we execute the configuration file to achieve the purpose of remote operatio
Ansible playbook component, ansibleplaybook
Core elements of playbook:
Tasks: Task
Variables: Variable
Templates: Template
Handlers: Processor
Roles: Role
Organization format: YAML (also known as a Markup Language)
Syntax: (the list is represented by a horizontal bar. Key-value pairs are separated by colons, and other key-value pairs can be nested in key-value pa
Meet a demand today when using Ansible-playbook after executing a script, according to the content returned by the script to determine whether to continue execution or break execution, query official website found using Register Register can be used to achieve the recording script output, using when+ Fail module to determine whether to proceed or break down, here is a simple example:
Playbook is a list of one or more "play"The main function of play is to dress up a pre-set host as a role defined in advance through the task in ansible. Fundamentally, the so-called task is nothing more than a call to Ansible's module. By organizing multiple play in one playbook, you can connect them to run in a pre-programmed mechanism.Playbook use Yaml languag
There are many ways to define and reference variables in Ansible playbook, which are tested in the local environment and collated as follows. test Environment:
Using your own Mac notebook to install Ansible as the control server, the VMware Fusion virtual machine runs on a CENTOS7 virtual machine (192.168.243.146) as a remote controlled host tested with
0. IntroductionPlaybooks is the language of Ansible management configuration, deployment applications, and orchestration, and you can use playbooks to describe the policies you want to perform on the remote host or the set of steps that you perform.Similar to a set of task sets, defining information such as projects, organizational structures, profiles, and so on, the task is to organize the things you want to do in one step and the whole playbookOffi
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 applica
;#Ansible: TimeSync* * * * */5 */usr/sbin/ntpdate 172.16.0.1 >/dev/nullDelete Crontab[Email protected] ~]# ansible cce-m cron-a ' name= "TimeSync" state= "absent" '6. Use the Fetch module to pull the directory on the remote host to the local[Email protected] ~]# ansible cce-m fetch-a ' Src=/root/cce dest=/root/cce '7. Use the file module to manage files on the re
Official documents See http://docs.ansible.com/ansible/dev_guide/developing_api.htmlTake the official example and revise it as followsImportJSON fromCollectionsImportNamedtuple fromAnsible.parsing.dataloaderImportDataloader fromAnsible.varsImportVariablemanager fromAnsible.inventoryImportInventory fromAnsible.playbook.playImportPlay fromAnsible.executor.task_queue_managerImportTaskqueuemanagerFrom Ansible.executor.task_result import Taskresult fromAns
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
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
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
need to send the key to the production environment host2. Upgrade and RollbackUpgradeAnsible-playbook/home/app/api.yml-vRolling backAnsible-playbook/home/app/api-rollback.yml-vAnsible-playbook followed by the Yml file path written earlier,-V is to display detailed execution information3. AttentionIf you perform an upgrade and rollback of the yml file in Jenkins,
As we all know, Ansible's playbook will not show the standard output.How can you make ansible like commands line with standard output?Ansible boss+merchant+web-m shell-a "Hostname;ip a" 192.168.6.210 |Success | Rc=0 >>pay-boss+merchant+web1:lo: Let's try it with playbook [emailprotected]:/etc/
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.