One of the most important functions in ansible is the ability to execute AD-HOC commands, and some people may not understand the meaning of the word ad-hoc, which means instant meaning, or arbitrary meaning.In contrast to the Ansible playbook function, playbook is suitable for batch deployment environments and is generally not frequently changed. The Ad-hoc command applies to operational scenarios such as b
idempotent featuresEach task must have a name, so that when the playbook is run, the task execution information from its outputis a good way to identify which task it belongs to, and if no value of name,action is defined, it will be used asMarking a specific task in the output informationIf you want to declare a task that previously had a format: Action:module options, it is now recommended to useThe more common format module:optionThe following is a basic task
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 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
Command ModuleThe command module is the ansible default module, the command module is used when the-m parameter is not specified;Comand modules are simple, common commands can be used, but the execution of their commands is not performed through the shell, so, such as "Example: displaying the current user[[email protected] ~]# ansible all-a ' whoami ' db |SUCCESS |Rc=0 >>rootweb |SUCCESS |Rc=0 >>root192.168
Tags: ansible configuration ansible+tornado ansible operation and maintenance system development automation operation and maintenanceA while ago I learned a bit about ansible configuration management (http://blog.csdn.net/column/details/ansible.html anisble Configuration Tool translation column), feeling very powerful,
Iv. Configuration of InventoryAnsible defines hosts and groups through inventory, allowing time to be read through-I, default/etc/ansible/hosts. Multiple inventory can exist, enabling dynamic generation.1. Define hosts and Groups# vim/etc/ansible/hosts192.168.12.22 #可以直接为IP地址Nfs.magedu.com #可以是域名ntp.magedu.com:2200 #可以: Connect to SSH Port[webserver] #[] is a group name, the following are the group membersw
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.