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/
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]#
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
Previously, due to job requirements, Saltstack's LVS remote execution module, LVS Service status Management module and LVS Server Status Management module were written and submitted to Saltstack official loadblance (DR) and Realserver configuration management.front-facing readingLVS-DR mode configuration in detail, it should be noted that the LVS-DR mode of work in the data link layer, the text describes the need to open ip_forward, in fact, no need,
Saltstack IntroductionSalt is a basic platform management tool. The saltstack uses the C/s mode, and the server side is the master,client end of the salt, which communicates between Minion,minion and master through ZEROMQ Message Queuing. Master listens on 4505 and 4506 ports, 4505 is the master and Minion authenticated communication ports, and 4506 performs return information for commands that Master uses
Preface: Manually go to each server hardware information and records have passed, whether through the script or Automation tools can be written to crawl everywhere, this article mainly use Saltstack as a tool, and then use its provided API to write the required Python script ~ ~The requirements are as follows: Generate server hostname, IP address, memory, CPU cores, operating system, data disk quotas, main operating servicesSaltstack Quick Start, refe
Demand generation Scenarios: 1, Python virtualenv Virtual environments are very useful. NBSP;2, saltstack as an important component of operation and maintenance automation is also very useful. But: 1, SALTSATCK is easiest to install with Yum, combined with the python2.6 version Linux-centos comes with. NBSP;2, even with compile and install, also in the Python environment of compiling and installing NBSP;SO, the demand produced: I want to use
Requirement Description:
1) if there is no Marshall user on a node with hundreds of Linux servers, add the user and replace the second field in the/etc/shadow column. If the user exists, replace the second field character of/etc/shadow.
2) check whether there is a sudo command on the node server. If there is a sudo command, it means it exists. Otherwise, install the sudo command.
3) enables the Marshall user to execute all the commands with the root permission.
1. Set up the
Deployment and Management of nginx with source code of saltstack
Saltstack has been in touch for some time. I feel that saltstack is powerful in state file deployment, which can save us a lot of time for mass deployment, today, we will deploy nginx in the source code by deploying the front-end forwarding server. We hope you can provide more guidance.
Ideas:
1. Us
http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Finally, it is found that the most important problem is the communication between development and operation.
Saltstack is a centralized server infrastructure management platform with configuration management, remote execution, monitoring and other functions, can be understood as a simplified version of the Puppet, which is based on the Python language implementation, combined wi
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
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
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
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
Original link: http://blog.csdn.net/xyang81/article/details/51568227Ansible Introduction: Ansible is a simple and efficient automated operation and maintenance management tool, developed in Python, can be used in large quantities to manage n multiple machines, can concurrently deploy applications on multiple machines, install software, execute commands, configuration and orchestration tasks. The bulk installation of the Zabbix_agenet client will be me
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
This is lighter than saltstack, and does not know how fast it is ....Reference Documentation:Http://linux.cn/article-4215-1.htmlwget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm RPM-IVH epel-release-6-8. noarch.rpmyuminstall ansibleAnsible Command Guide:Usage:ansible [options]options:-A Module_args,--args=Module_args MODULE Arguments--ask-become-pass Ask forPrivilege escalation Password-K,--ask-pass ask forSSH Passwo
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.