Automated operations Tools: ansible
Application scenario for multi-process call Ansible API: Application System Check
An application system may have a cluster of 20-50 servers, and a preliminary system-level check can be checked with a unified playbook, such as (Df-h command). But deep into the application layer, there are some personalized applications, such as 2 HTTP servers, 20 middleware
The CMDB crawls service information in many ways, using automated tools Saltstack, Ansible, puppet, or using other modules to directly SSH remote connections to fetch server information. Here is a record of using the Ansible API interface to invoke the Setup module fetch.Experiment using two machines
Ip
System
Software
192.168.93.137
Centos6.5_x64
The fetch module is the same as the copy function, which is the file transfer between different machines, the former is pulling files from the node to the master machine (the machine with ansible), the latter is transferring files from the master to the node. The template module can insert variables into the copied file.(Official document) the Copy module copies a file on the local box to remote locations. Use the Fetch module to copy files from remot
Install: Dependent packages: A jinja2:python of the designer-friendly modern template language Pyyaml:python a YAML encoding/deserialization function library Paramiko: SSHv2 written in pure Python Protocol function Library HTTPLIB2: A full-featured HTTP client function library installation Ansible[[emailprotected]~]#yumlist|grep-i ansibleFailedtosetlocale,defaultingtoCansible.noarch 1.9.2-1.el6 epelansible-inventory-grapher.noa
1. Introduction1.1. Company environment use Puppet, but I prefer ansible, reason two, first, I am Red Hat loyalty powder:), second, I am more familiar with Python1.2. Ansible Official website: https://www.ansible.com/1.3. Ansible Chinese document website: http://www.ansible.com.cn/2. Environment2.1. Ansible:ansible-2.4.2.0-1.el73. Installation3.1. Direct Yum is g
Ansible-Bulk Linux management tools"Ansible is easy it Automation"--simple automated IT tools.
Batch execution of commands on a remote server
Automating the deployment of apps
Automation Management Configuration Items
Automated Cloud service Management
Install (Ubuntu)Rely on SSH and python
Apt-get Install Ansible
Co
From http://blog.chinaunix.net/uid-20642150-id-4096719.htmlansible-Batch Linux management toolsHttps://github.com/ansible/ansibleInadvertently see this project, feel very similar to puppet, take the time to understand, found is very good, and support the use of Python to add their own modules, very simple.and relatively speaking, Ansible has the following advantages:1, lightweight, he does not need to go to
Tags: SCP type HTTP D3D firewalld non-dense dir rip colProcedure Note: First stop the Selinx and iptables and make sure that the server CD-ROM has a disc and is linked/etc/init.d/iptables Stop (C6)Systemctl Stop Firewalld (C7)Setenforce 0 temporarily close SELinux
1: Install Epel source1:yum-y Install Lrzsz2:rz + Epel with script and source database binaries3: InstallationExample: Rpm-ivh epel-release-latest-6.noarch (C6)
2: Install AnsibleYum-y Install
Tag: Equals line chown Package date file Service Playbook Word1.1 Synchronizing the MySQL package to the client server for pre-installationPs:mysql Install the package line to the/ansible/roles/mysql/files directory on the ansible server vim/ansible/roles/mysql/tasks/main.yml
- name:copy mysql_tar_gz to client
copy:src= mysql-5.6. tar.gz dest=/tmp/mysql-5.6.
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 tar
Easy to use roles for large projectsDirectory structure Orchestration650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/8C/36/wKiom1hlF-SjFR-QAAHrlrracRc046.png-wh_500x0-wm_3 -wmp_4-s_1176155170.png "title=" 1.png "alt=" Wkiom1hlf-sjfr-qaahrlrracrc046.png-wh_50 "/>One click to install HTTPD and provide serviceCreate a directory structure[[email protected] ansible]# mkdir-p Roles/httpd/{tasks,files,vars}[Email protected]
Batch execution playbooksAnother way of remote batch command execution is to use playbooks;This is Playbooks's Official document: http://docs.ansible.com/playbooks.htmlHere are playbooks examples of ansible: https://github.com/ansible/ansible-examplesUsing the Ansbile API in PythonThe above methods of executing the Ansible
When the integrated Jenkins and ansible implement an automated deployment, the root user performs the ansible command when it is run correctly. Because the ansible command was executed through the Jenkins user, the Jenkins user reported the following exception:XXXXXXX | unreachable! = = {"changed"false, "msg " " Failed to connect to the host via SSH. " ,
Ansible automatic operation and maintenance (i.)I. Ansible automated operation and maintenanceSecond, ansible installation1. Basic Software Installation(1) Installation python-2.7.8CD python-2.7.8./configure--prefix=/usr/local make make install#如果ansible找不到python头文件的话, copy the Pytho header file to the standard direc
1. An error occurred while calling the ansible command after installation.
Successfully installed ansible
Cleaning up...
[[Email protected] python_src] # ansible -- version
Traceback (most recent call last ):
File "/usr/bin/ansible", line 25, in
From ansible. Ru
On Centos6.5, Ansible manages Windows and centos6.5ansible
Install dependency packages
Install PyCrypto: http://blog.csdn.net/eric_sunah/article/details/45826933
Install paramiko (http://blog.csdn.net/zyz511919766/article/details/18355795)
Install pywinrm: pip install http://github.com/diyan/pywinrm/archive/master.zip#egg=pywinrm
Configure PowerShell
Use the $ PSVersionTable. PSVersion command to query the Powershell version. i
Because the company Ali server changes several times, manually deployed several times Fastdfs+nginx, so think of the automated deployment, the following is the script content, because just want to implement the function, has not completed the complete judgment logic;The following is Ansible-playbook and shell and template Nginx-fastdfs and dynamic thumbnail configuration;If there are errors, please advise;----Hosts:apollo # VARs: # filedest:/usr/local
I. Introduction of AnsibleAnsible 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
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.