I. Ansible INTRODUCTION
Commonly used automated maintenance tools
Puppet -Ruby-based development with C/S architecture, strong extensibility, SSL-based, and relatively weak remote command execution
Saltstack -based on Python, with C/S architecture, relatively puppet and lighter, configuration syntax using Ymal, making configuration scripts simpler ansible-based on Pythonparamiko development, distributed, without clients, light Magnitude, configuration syntax using Ymal and JINJA2 template language, stronger remote command execution other DevOps see: https://github.com/geekwolf/sa-scripts/blob/master/ Devops.md
Ansible is a simple automated operations management tool that can be used to automate the deployment of applications, configure, orchestrate tasks (continuous delivery, no downtime updates, etc.), use the Paramiko Protocol library (which is also used by fabric), and connect via SSH or ZeroMQ Host, release a main version about every 2 months
Ansible working mechanism
Ansible in the Management node will Ansible module through the SSH protocol (or Kerberos, LDAP) to be executed by the management side, automatically delete after execution, you can use SVN to manage the custom modules and orchestration
From the figure above you can see that the composition of the Ansible consists of 5 parts:
Ansible: Core engine
Modules: Includes the core module of the Ansible and the Custom module (Modules);
Core modules: Ansible module resources are distributed to remote nodes so that they perform specific tasks or match a specific state.
Custom module: You can add a custom module if the core module is not sufficient to complete a function.
Plugins: Complete the module functions, including connection plug-ins, mail plugins, etc.
playbooks: Many online translation for the script, the individual feel that the arrangement is more reasonable; Define the configuration file for the Ansible task, you can define multiple tasks in a script, automatically executed by ansible, script execution supports multiple tasks, Multiple tasks can be run by the control host while managing multiple remote hosts.
Inventory: Defining a checklist for Ansible management hosts
Ansible Functional characteristics
- Application code Automation deployment.
- System administration configuration Automation.
- Support continuous delivery automation.
- Support environments such as cloud computing, big data platforms such as AWS, OpenStack, VMware, and more.
- Lightweight, there is no need to install agent on the client, only one update on the control machine is required when updating.
- Bulk task execution can be written as a script that can be executed without being distributed to the remote.
- Written in Python, maintenance is simpler and ruby syntax is too complex.
- Support for non-root user management operations, sudo support.
Two. Installing Ansible
Preparation before installation:
1. Because ansible is Python-based, check for Python first, and if no installation is required (note that the version is too low, it can also cause the installation to fail).
2. Install a dependency package before installing ansible
Yum-y Install Epel-release
......
Ansible Installation:
Yum-y Install Ansible
.......
After the installation is complete, you need to configure the unit:
Vim/etc/ansible/hosts
Here my unit name is [Ccdoop], the following is my other 2 machine configuration (this machine is: test1:192.168.254.130)
Test2 192.168.254.131
Test3 192.168.254.132
By the ansible here, the installation is complete.
Test:
Ansible all-m Ping
Result: Success!
Note: Because this machine has only one group [Ccdoop], so with all, if there are multiple units, and you only want to test a group, you can replace all with the group name, such as:
Preliminary discussion on Ansible installation