Ansible using advanced steps
Experimental Environment
Group: Srvs
Group member host name, system version, and IP
Node1 centos-7-core 172.16.253.184
node2 centos-7-core 172.16.254.89
node3 centos-7-core 172.16.253.47
Node4 Centos-6-core 172.16.253.30
iterative function of PlaybookSimple item to use
---
-hosts:srvs
remote_user:root
tasks:
-name:copy files
tags:copy
when:ansible_ Distribution_major_version = = "7"
copy:src=/root/
]RET = []For term in terms:term = str (term)p = subprocess. Popen (term, cwd=self.basedir, Shell=true, stdin=subprocess. PIPE, Stdout=subprocess. PIPE)(stdout, stderr) = P.communicate ()If P.returncode = 0:Ret.append (Stdout.decode ("Utf-8"). Rstrip ())ElseRaise errors. Ansibleerror ("Lookup_plugin.pipe (%s) returned%d"% (term, p.returncode))return ret
I ran a test that was simple:Through the results we see that he will find the appropriate plu
|get_ebs_id}}"
And then it's okay.
example, Ilter_plugins plugin implements JINJA2 template filter filter
Ansible supports the default built-in filter usage in JINJA2, which is part of the! Each of the specific features I do not say in detail, we will know the use of the test.
ABS (number)Absolute
attr (obj, name)Property
{{My_variable|default (' my_variable is not Defined ')}}If there are no values,
Introduction: Ansible is a new automated operations tools, based on Python development, the collection of many 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 deploymen
Common ansible module usage
Ansible provides many modules by default. In Linux, we can run the ansible-doc-l command to check which modules are supported by ansible, you can use the ansible-doc-s Module name to view the parameters available for this module.
The following des
Tags: authorize ADT upd Ping install repos target host TargeAnsible is a tool for batch deploymentReference: Ansible Chinese authoritative guide1. Installationsudo apt-get install Software-properties-commonsudo apt-add-repository ppa:ansible/ansiblesudo apt-get Updatesudo Apt-get Install Ansible2. Add the IP of the server in the/etc/ansible/hosts fileVim/etc/ansible
Use ansible to manage remote servers in batches.Use ansible to batch manage remote server background
Local management of a batch of remote servers is required, mainly to execute the following tasks:
1) Copy local files to all remote servers;2) execute commands on the remote server;
The paths of the remote server are not completely consistent. Generally, access is performed through the variable paths defined
First, what kind of situation requires a lot of deployment
1, the installation of the operating system
Common is collber,red hat satelite (Redhat) system dedicated.
2, the operating system configuration
Common to have cfengine,puppet,chef,func. One of the most popular puppet
3, the deployment of batch programs
4, the volume command run View status information
Ii. introduction of Ansible
The structure of the ansibl
The following is the playbook example structure, specific reference http://lansgg.blog.51cto.com/5675165/1749179 reference Ansible deployment Tomcat and include mechanism written in very detailed. ├──hosts├──roles│└──http│├── default│├──files│ │├──apache-tomcat-8.0.33.tar.gz││ ├──jdk-8u65-linux-x64.tar.gz││ └──root││└── test.html│├──handlers│ │└──main.yml│├──meta│ │└──test│ │nbSp;└──test.html│├──tasks│ │├
Summed up are some of their own use of relatively simple knowledge, about State.sls and playbooks and other knowledge is still learning ... 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0059.gif "alt=" J_0059.gif "/>AnsibleLightweight, automated operations tools, SSH-based, no client-sideInstallation and Configuration1, the main control end loaded ansible (yum install-y ansible)2. Import the mai
Today, we found a bash vulnerability, but I have nearly 1000 servers. To facilitate and save time, I feel that I am using ansible to install the bash update package. Next I will share my installation method.
1. Installed playbook content
19:00:03#cd/etc/ansible[emailprotected]:/etc/ansible19:00:06#catupdate_bash.yml----hosts:"{{host}}"remote_user:"{{user}}"gather_facts:Truetasks:-name:updatebashinredhat6ver
Use Ansible to publish Tomcat service in CentOS 71. About ansible
Ansible is an Open Server Deployment Tool for Python.Using yum for configuration is very simple and easy to learn.2. Install
Http://docs.ansible.com/ansible/intro_installation.htmlRefer to the official website and run yum install on CentOS 7.
sudo yum i
document is by default in v1.11.2 version
Kube-dns
1.14.10
This document is by default in the 1.14.10 version
Dashboard
1.8.3
This document is by default in the 1.8.3 version
Heapster
v1.5.4
This document is by default in the v1.5.4 version
Influxdb
v1.5.2
This document is by default in the v1.5.2 version
Grafana
v5.0.4
This document is by default in the v5.0.4 version
|+--------------+--------+-------------------------------------------+2 rows in set (0.00 sec)
As you can see, the installation has been completed as per my requirements. The deletion test is carried out below.
3. delete
10:49:18 # time ansible-playbook mysql_delete.yml --extra-vars "host=192.168.240.17 user=root" --private-key=/root/test.pem PLAY [192.168.240.17] ******************************************
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; +--------------+--------+-------------------------------------------+
| Host | user |
passwo
Ansible is a pythonpackage and is a complete unpackandplay software. The only requirement on the client is that ssh has python and python is installed with the python-simplejson package, which is easy to deploy to the terminal. This article will introduce ansible as a method example for python module library. you can refer to it for reference. Ansible is a python
First, IntroductionAnsible is strong in the playbooks, but in order to use the playbooks very well, we must first have some foundation. such as: How to write a one-time script command? How do you know which modules are available? How are each module used? such asWith this article, you can learn how to use one-time commands and some modules.After installing Ansible, to get started, you also need to create a list of controlled hosts. Default Read/etc/
The main changes in the Ansible 1.9.0 (version code is dancing in the street,ansible each major version of a song in the Vanhallen band) are: Added Kerberos support to WinRM Connection plugin. Tags rehaul:added ' all ', ' always ', ' untagged ' and ' tagged ' special tags and normalized tag resolution. Added tag information to--list-tasks and new--list-tags option. Privilege escalation generalization, new '
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.