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
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 applicati
If you have a BlackBerryPlayBook tablet and develop it in Ubuntu, you can do this by connecting to the NDK. But how can you transfer files under Ubuntu12.04LTS? Haha! Just a few simple steps to operate the files in PlayBook like a USB flash drive in windows! Premise: the same vro connected to the computer and
Can PlayBook run Android programs? The dust has finally landed!
RIM announced yesterday that in order to bring applications into the PlayBook ecosystem, it will provide developers with tools to enable PlayBook to support Android applications. RIM is preparing to launch the software tool "App Players" to enable BlackBerry's Java and Android 2.3 programs to run si
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
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
If you have a big playbook and you just want to run one of those tasks, tags is your best choice. How to use it?first, the most common form of use:Take the official example:
Tasks:-yum:name={{Item}} state=installed with_items:-httpd-memcached Tags:- PACKAGES-TEMPLATE:SRC=TEMPLATES/SRC.J2 dest=/etc/foo.conf Tags:-configuration At this point if you want to run only one of these tasks, this Run when you speci
Cluster O M automation tool ansible uses playbook to install mysql Cluster
Last time I introduced how to use ansible playbook to install the zabbix client (http://www.bitsCN.com/article/52158.htm), this time I introduced how to use playbook to install mysql.
The following is the information for installing mysql:
Mysql_basedir:/data/mysql/basedir source code di
/
./Configure \-- Prefix =/usr/local/nginx \-- User = nginx \-- Group = nginx \With-http_stub_status_module
Make make install
Ln-S/usr/local/nginx/sbin/nginx/usr/local/sbin // create a soft connection for the system to identify nginx commandsScript Note: -- with-http_stub_status_module // support status statistics
2. Create nginx boot scriptVI/etc/init. d/nginx#! /Bin/bash# Chkconfig:-99 20# Description: nginx Service Control scriptProg = "/usr/local
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
statement.
mysql> show databases; +--------------------+
|
Database | +--------------------+
| Information_schema | | MySQL | |
Performance_schema | +--------------------+ 3 rows in Set (0.00 sec) mysql> with MySQL Reading table information for completion of table and Column names You can turn out this feature to get a quicker startup with-a Database changed mysql> select Host,user,
password from user; +-
Include:In a large complex architecture, the first problem is the growing playbook file size, a large playbook difficult to understand and maintain, the end method is to use include, your plays break down into different segments and then include them in the other plays . Different segments are categorized according to
After Ubuntu is installed on the real machine, the PlayBook NDK 2.0 Environment is installed on it. The installation process is not detailed. If you need to learn the detailed steps, refer to my friend berryreload's tutorial, the link is as follows:Http://www.bkjia.com/ OS /201203/122981.htmlAs mentioned by berryreload, after the PlayBook NDK 2.0 Environment is installed according to the standard process, t
Frontier: ansible are all good, so let's talk about lookup plugins this plugin. Lookup_plugins is mainly used to implement extensions of various strings and variables within the extended playbook. For me personally, the use is not too big, but looked at the official Lookup_plugins extension list, there are some ideas. When you first use lookup, you encounter a problem where the data in {lookup}} is
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/ansible#ansible-playbook
listvariable_manager.set_inventory (Inventory)#Create play with TasksPlay_source =dict (Name="Ansible Play", the hosts='Web',#the hosts variable that corresponds to the Playbook entry Yaml file, or it can be an IPGather_facts ='No', Tasks=[Dict (Action=dict (module='Shell', args='ifconfig'), register='Shell_out'), #dict (action=dict (module= ' Debug ', Args=dict (msg= ' {{shell_out.stdout}} ' )))]) Play= Play (). Load (Play_source, Variabl
ansible Role
Ansilbe new features introduced from version 1.2, for hierarchical, structured organization playbook;roles to automatically load variable files, tasks, and handlers based on hierarchical structure.to use roles, you only need to use the include directive in playbook.
simply put, roles is a mechanism by which variables, files, tasks, modules, a
1. Create a MySQL playbook structure[Email protected] roles]# pwd/etc/ansible/roles[[email protected] roles]# mkdir-p Mysql_install/{files,handlers,meta, Tasks,templates,vars}[[email protected] roles]# tree mysql_install/mysql_install/├──files├──handlers├──meta├── Tasks├──templates└──vars2. Create the VARs you need to use[Email protected] roles]# cat/etc/ansible/roles/mysql_install/vars/main.ymlmysql_versio
;#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 remote host[Email protected] ~]# ansible cce-m
Example of ansible compiling httpd playbook, ansibleplaybook
The following is the content of the playbook. The process is as follows:
1. First, a total of 3 .tar.gz files are downloaded in the local directory of apr, apr-util, and httpd.
2. decompress the three files.
3. Install the pcre and pcre-devel dependency packages.
4. Compile and install apr.
5. Compile a
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.