1. Introduction
Ansible 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 provides a framework. Mainly include:
(1), connection plug-in connection plugins: responsible for and be monitored to achieve communication;
(2), host Inventory: Specifies 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. Installation
#rpm-IVH http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
#rpm-IVH http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/atomic-release-1.0-19.el6.art.noarch.rpm
#cd/etc/yum.repos.d/
#wget Http://mirrors.163.com/.help/CentOS6-Base-163.repo
#yum Install Pyyaml
#yum Install Ansible
3. Configuration
The default host list file is/etc/ansible/hosts
ansible_ssh_port= Port
ansible_ssh_user= User Name
ansible_ssh_private_key_file= private Key Location
Master configuration file/etc/ansible/ansible.cfg
Host_key_checking = False does not perform a host_key check, omitting the step of entering (yes/no) when the target key is changed
SSH Password-free login
#ssh-keygen-t RSA generate public key
#cat ~/.ssh/id_rsa.pub | Ssh-p port [email protected] ' cat >> ~/.ssh/authorized_keys && chmod ~/.ssh/authorized_keys ' copy public key to node
4. Use
Ansible
Format ansible host parameters/modules
Common parameters
-M Specify module
-k password login without password login with public key
-u specifies that the user does not add the default root login
-A ' command ' Remote execute command
To be continued, to be continuously updated .....
Ansible deployment and application--Continuous update