=Play.nameclassMy_ansible_play (): #这里是ansible运行 #初始化各项参数, most are defined, only a few parameters are required to pass in the Def __init__ (self, playbook, EXTRA_VARS={}, Host_list='/etc/ansible/hosts', Connection='SSH', become=False, Become_user=None, Module_path=None, fork= -, Ansible_cfg=none, #os. environ["Ansible_config"] =None Passwords={}, check=False): Self.playbook_path=Playbook Self.passwords=Pas
There are two more secure ways to store this type of data:The 1.ansible command-line tool Ansible-vault can encrypt and decrypt files used by any ansible.2. Use a third-party key Management service to store data.Ansible-vault can create, edit, encrypt, decrypt, and view files. Ansible Vault can encrypt any ansible used file, contains inventory variables, playbook variable files that are called in, pass parameters to
Playbooks Concept:Tasks:Tasks: Specific operational tasks that are supported by each module:Example:-M user-a ' name= password= 'Variables:Variable:Templates:Template:After defining the template, you can implement the variables corresponding to each node to replace the expression itself according to the current nodeThe assigned value is used to perform the operation, and the resulting value is given this parameter for generating configuration files of different configurations.So the template is
-playbook -i inventory.ini local_prepare.yml
Initializes each node of the cluster. Checks the Inventory.ini configuration file, Python version, network status, operating system version, and so on, and modifies some kernel parameters to create the appropriate directory.
Modify the configuration file as follows
## Connection# ssh via root:ansible_user = root# ansible_become = trueansible_become_user = tidb# ssh via normal user# ansibl
the operation of the host, is a configuration file inside the definition of monitoring host;(3), various modules core module, command module, custom module;(4), with the help of the plug-in to complete log mail and other functions;(5), playbook: When a script performs multiple tasks, it is not necessary to allow the node to run multiple tasks at once.2 , Overall architecture3 , features(1), no agents: no need to install any client on the managed host
Config_file:yumDisable_gpg_check: Close Gpg_checkDisablerepo: Do not enable a sourceEnablerepo: Enable a sourceListName: You can also pass a URL or a local rpm path for the package to be manipulated.State: Status (Present,absent,latest)Instance:-Name: Install the latest version of Apache YUM:NAME=HTTPD state=latest-name: Remove Apache yum:name=httpd state=absent-name: Install a special version of Apache YUM:NAME=HTTPD-2.2.29-1.4.AMZN1 State=present-name: Upgrade all Packages yum:name=* state=la
Ansible automated O M tool and ansible automated
1 Ansible
1> introduction to ansible
Ansible is a new automatic O M tool developed based on Python. It integrates the advantages of many O M tools (puppet, cfengine, chef, func, fabric, implements batch system configuration, batch Program Department, batch run command, and other functions. Ansible works based on modules and does not support batch deployment. The modules run by ansible are actually deployed in batches. ansible only provides a fr
I. Introduction of Ansible1 , IntroductionAnsible is a new automated operation tools, based on Python development, the collection of a number of operations tools (puppet, Cfengine, Chef, func, fabric) The advantages of 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 Ansible runs, and Ansible just prov
In fact, most of them refer to other people's blog to do, their own modifications prepared tomcat.tar.gz after the optimization of the reference http://vekergu.blog.51cto.com/9966832/ 1672931 optimize Apr mode on Tomcat use the root default directory file Tomcat.shserver.xml to create some directories and give permission/opt/src/logs start sh/opt/ea/ tomcat.shcattomcat.sh#!/bin/bashjava_opts= "-xms2048m-xmx2048m-xmn384m" Java_Home=/usr/java/ jdktomcat_home=/opt/ea/tomcattomcat_user=tomcatchown $
O M automation-ansibleplaybook installing mysql last introduced how to use ansible playbook to install zabbix client (http://dl528888.blog.51cto.com/2382721/1436745), this time introduced how to use playbook to install mysql.
The following is the information for installing mysql:
Mysql_basedir:/data/mysql/basedir source code directory mysql_datadir: 3306mysql listening port mysql_sock:/data/mysql/datadir/
defined in YAML format to enable distribution of application deployments to multiple hosts.Here is a detailed description of a Playbook deployment example for Nginx nested reuse architecture:1. Building the directory structure# cd/etc/ansible/# mkdir group_vars# mkdir roles2. Define the host# vi/etc/ansible/hosts[webservers]client01.example.comclient02.example.com[nginx01]client01.example.com[nginx02 ]client02.example.com3. Defining variables# Vi/etc
Requirements:Batch Modify the server's account (assuming root account) password, with a randomly generated string to do the password
Environment:Assume that the target group for the server in the/etc/ansible/hosts file is as follows
[Target-servers]
192.168.0.[1:100]
Perform Actions
1 generate random strings for candidate password characters on each remote server using the OpenSSL rand command
Ansible target-servers-m shell-a "OpenSSL rand-base64 > ~/.openssl"
You can view the results of a bu
[Openvswitch, Linuxbridge]-#neutron_plugin_agent: "Openvswitch"+neutron_plugin_agent: "Openvswitch"##################### OpenStack Options##################### This option was used to specify the "tag to" when pulling the Docker images-#openstack_release: "Latest"+openstack_release: "Kilo"# Use these options to set the various log levels across all OpenStack projects-#openstack_logging_verbose: "True"+openstack_logging_verbose: "True"#openstack_logging_debug: "False"# OpenStack Services can is
? Messages of the day customized for the security level of the machine? Database servers running PostgreSQL or MySQLTo manage roles in Ansible perform the following steps:1. Create a folder named roles with your playbooks.2. In the roles folder, make a folder for each role that you would like.3. In the folder for each role, make folders named files , handlers , meta ,tasks , templates , and finally vars . If you aren't going to use all these,you can leave the ones you don't need off. Ansibl
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.