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 packa
-util--with-apr=/usr/local/Apr Make Make Install-name:complie httpd Shell:|CD/root/httpd-2.4. - ./configure--prefix=/usr/local/apache--sysconfdir=/etc/Apache--enable-mpms-shared= All--with-z--with-Pcre--with-apr=/usr/local/Apr--with-apr-util=/usr/local/apr-util--with-mpm=Event Make Make InstallAfter compiling, there are a series of actions, such as setting the PATH environment variable, setting the man path, modifying the configuration file, starting httpd, and so on. The
detects changes that may occur, but does not actually perform the operation–list-hosts List the hosts running the task–limit host list is only performed for hosts in the host list-V Show procedure-VV-VVV more details
ExampleAnsible-playbook file.yml--check Detection onlyAnsible-playbook file.ymlAnsible-playbook file.yml--limit Websrvs
variablesGroup variables are variables that can be directly used in palybook by setting hi to a specified host, such:
[aaa-vars]net_server=ntp.example.orgnfs_server=nfs.example.org
3) group nestingGroups in inventory can also be nested in other groups, or you can specify variables to the hosts in the group, but these variables can only be used in ansible-playbook tools, direct use of the
execute, and handlers defines which calls
Processor
Is a simple example:
How can I run my defined scripts? Use the ansible-playbook command, for example, ansible-playbook/root/first.
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 f
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
.YAML file extension is usually yml or YamlIntroduction to YAML Syntax:ListList: Lists, all of whose elements begin with "-"Example:# A List of tasty fruits–apple–orange–strawberry–mangoDictionaryDictionary: A dictionary, usually consisting of multiple keys and valueExample:—# an Employee recordName:example DeveloperJob:developerSkill:eliteYou can also place key:value in {} to represent, separating multiple key:valueExample:—# an Employee record{name:
,'skipped':0,'OK':2,'changed':1,'Failures':0}}Third, Java calls Python program for playbook executionUse Java to invoke Python for Java execution playbookTest.java1 ImportJava.io.InputStreamReader;2 3 ImportJava.io.BufferedReader;4 5 ImportJava.io.InputStream;6 7 Importjava.io.IOException;8 9 Public classtest{Ten One Public Static voidMain (String args[])throwsioexception{ A -String command= "python/o
single host-defined variable value of 2 to define variables by Host_vars and Group_vars directories
The/etc/ansible/directory is the ansible default profile directory on a Linux system (the default configuration directory for Mac Systems is/usr/local/etc/ansible/), where Host_vars and Group_ are created in this directory VARs Two directories are used to store fi
Playbook-Introduction: Playbooks is a mode different from the ansible command line execution mode, and its functions are more powerful and flexible. In simple terms, playbook is a very simple configuration management and multi-host deployment system. Unlike any existing mode, it can be used as a suitable basis for depl
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
foo /bin/foo- name : Placeholder Bar /bin/barPlaybook file used: PLAYBOOK.YMLtasks: # using include to reference the functionality of MultiplexingRoleRole: Ansible custom good standard specification, with different levels of directory hierarchy and files on the role, variables, tasks, handlers, etc. to split, for the subsequent function expansion, maintainability lay the foundation.Cases:Take the above nginx.yml as an
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
Although nginx can also be installed through yum, how can I use the source code package to install and enable some nginx functional modules, and send them to the managed cluster through ansible? The following provides a specific example for the bit viewer for reference.
First, we need to manually compile an nginx server as a template, and then use roles role management to decouple it and deliver it to the m
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 confi
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
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
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.