Read about ansible playbook for linux patching, The latest news, videos, and discussion topics about ansible playbook for linux patching from alibabacloud.com
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
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
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 direct
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
execution, one responsible for planning, Nice.A simple playbook
A simple playbook should be as follows:
---
What did the above playbook do? Explain the task section. People who are familiar with Linux may be able to guess 78:1. Use yum to install the latest apache version.2. overwrite the httpd. conf configuration fi
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
Ansible-playbook JDK InstallationThe directory structure for JDK role is as follows:[Email protected] roles]# tree Jdkjdk├──defaults├──files│└──jdk-8u101-linux-x64.tar.gz├──handlers├──meta├──tasks │└──main.yml├──templates└──vars└──main.yml#vars下面的忽略, that's the one that was written before.The contents of the task file are as follows:[[emailprotected]tasks]#catmai
-7.0.63.zipfile:path=/data/apache-tomcat-{{tomcat_version}}.zip state=absent# Cat Vars/main.ymltomcat_version:7.0.63#roles可以加个jdk, and Tomcat piece installation.#cat tomcat.yml-hosts:test remote_user:root roles:-Tomcat#tomcat Playbook Run the following procedure:#ansible-playbooktomcat.yml-l192.168.121.129play[test]******************** task[setup]*************************************** ok:[192.168.121.129]t
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
-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
protected] ~]# cat Useradd.yaml #查看内容-Hosts:webserver #定义主机组User:root #远程链接用户VARsUser:jerry #添加的用户名tasks: #任务-Name:add User #任务名称Action:user name={{User}} PASSWORD=-LUVLRZEXUGHM shell=/bin/bash home=/home/{{user}} #指定用户相关的信息 password must be a ciphertext salt encrypted login Shel L Host Directory3. Execute the Yaml file[Email protected] ~]# Ansible-playbook Useradd.yamlSuccess
Client node Va
1.ansible IntroductionAnsible is an automated operations tools, based on Python development, the collection of many operations tools (puppet,cfengine,chef,func,fabric) advantages, the implementation of batch (System configuration, program deployment, Run command) and other functionsAnd Ansible is based on the module work, itself does not have the ability to deploy bulk, really have a batch deployment is
"‘(51) Delete a scheduled taskansible web_server -m cron -a ‘name="a job for reboot" state=absent‘(52) Mount Partitionansible web_server -m mount -a ‘name=/data src=/dev/sdb1 fstype=ext4 opts=rw state=mounted‘(53) Unmount partitionansible web_server -m mount -a ‘name=/data state=unmounted‘(54) Ensure that a partition is mounted and mounted if it is notansible web_server -m mount -a ‘name=/data src=/dev/sdb1 fstype=ext4 state=present‘For more information on p
1.ansible IntroductionAnsible is an automated operations tools, based on the development of Python, the collection of the advantages of many operations tools (puppet,cfengine,chef,func,fabric), 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
defined in the Hosts file remote_user:root //users running this task tasks: ///should be a task -name:taks_name//Task Name moudule_name:args[1]=?args[2]=? ..... //parameter, which is the-a option in the command ignore _errors:true//Ignore Errors notify: //if not changed the following events will not occur -handerls_name handlers:// The implementation performs the specified action once the change has completed, such as changing the configuration file and starting the service from the new one
Ansible-Bulk Linux management tools"Ansible is easy it Automation"--simple automated IT tools.
Batch execution of commands on a remote server
Automating the deployment of apps
Automation Management Configuration Items
Automated Cloud service Management
Install (Ubuntu)Rely on SSH and python
Apt-get Install
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.