Installation of AnsibleAnsible-Based on Python Paramiko development, distributed, no client, lightweight, configuration syntax using Ymal and JINJA2 template language, stronger remote commands to perform operations.Similar automated operations tools are commonly used in many other things:Puppet:-Based on Ruby development, with C/s architecture, strong extensibility, SSL-based, remote command execution is relatively weak.Saltstack:-Based on Python development, the C/S architecture, relatively pup
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 them to join together to sing a drama with a pre-programmed mechanism3 Playbook written in Ya
Common ansible Commands
Use Ansible-doc-l to see how specific modules are used, here are examples of common ansible simple usage Execution system commands
[Root@ansible ~]# ansible pinpoint-m shell-a ' hostname '-o # Execute system command
192.168.0.102 | SUCCESS | rc=0 |
Batch manage remote servers using AnsibleBackground
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 in the environment variables;For example, define $ app_path =/opt/app/bin in. bashrc.
Finally, ansib
Prerequisite: To install Tomcat first, please refer to the previously written blog post on Centos7 to install Tomcathttp://12395331.blog.51cto.com/12385331/1884980Installing Jenkins1> Download the Jenkins package. Enter the tomcat/webapps/directory, download the Jenkins.war package here, the following problems can be downloaded to this directory, the deployment of the process is not down for half a day, providing Jenkins accessorieswget Http://mirrors
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/
Ansible playbook component, ansibleplaybook
Core elements of playbook:
Tasks: Task
Variables: Variable
Templates: Template
Handlers: Processor
Roles: Role
Organization format: YAML (also known as a Markup Language)
Syntax: (the list is represented by a horizontal bar. Key-value pairs are separated by colons, and other key-value pairs can be nested in key-value pairs)
Example: name: tom
Age: 21
Gender: Male
Spourse:
Name: lily
Gender: female
Children:
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
AnsibleThe automated operation and maintenance system is divided into 3 structuresInstall operating system: OS provisionRepresentative Product: Pxe,cobblerTo install a specific file: OS ConfigRepresentative Product: PuppetTo perform a specific action (command): DeploymentRepresentative Product: AnsibleAnsible General Framework Diagram:650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/8A/E2/wKiom1g-KFrDGdwWAAJgLrRJMHY747.png "title=" Ansible.png "alt=" Wkiom1g-kfrdgdwwaajglrrjmhy747.png
For saltstack users, Ansible is a good ssh-based solution. It can greatly simplify the automatic configuration management and process control methods of Unix administrators. It uses the push method to configure the customer system so that all work can be done on the master server side. Its command line mechanism is also very powerful, and you can use the Web UI to implement authorization management and configuration, of course, free of charge is very
Any server can be the master terminal
1, install Epel Source:# RPM-IUVH http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
2. Install the package:# yum Install Ansible
3, set up SSH password-free login:# # Generate public/private key # Ssh-keygen-t Rsa-p ' # # Write a trusted file (distribute/root/.ssh/id_rsa_storm1.pub to other servers and execute the following on all servers): # CAT/ROOT/.SSH/ID_ Rsa_storm1.pub >>/root
Before I had summed up a little Ansible series Bowen, this article also take the previous space bar. In the current network application, the security-hardened host is not allowed to log in directly to the root user, and many commands require root users to perform, without rebuilding the current network. Hope that through a common user first landing, and then Su-cut to root execution. and the passwords for the regular and root users of each host are di
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
Ansible is a free and open source configuration and Automation tool developed for UNIX-like systems. It's written in Python, similar to chef and puppet, but there's a difference and the advantage is that we don't need to install any clients in the node. It uses SSH to communicate with the node. In this article we will install and configure ansible on CentOS7, and try to manage two nodes.Ansible Server –ansi
Command module:The 1:command module executes the command on the remote node:The command module is followed by the commands to be executed, and the arguments to the command are separated by spaces. The specified command executes on the selected node. The command is not executed through the shell, so environment variables such as $home and some operators (1 chdir switch to the specified directory before running the command.[Email protected] ansible]#
Ansible notesHosts: remote hostUser: Users who are executing the task groupRemote_user: Same as usersudo: If set to Yes, the user performing the task group gets root permission when the task is performed.Sudo_user: If you set user to Tom,sudo as Yes,sudo_user for Jerry, then Tom gets the permissions of the Jerry user.Connection: How to connect to the remote host.# # #gather: Collecting Facts: FactsGather_facts: Unless you explicitly indicate that you
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 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 file to achieve the purpose of remote operation and maintenance automation.First, the simple use of playbook
1. Create a File inst
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.