[Operation and maintenance] Ansible, an automated operation and maintenance tool in practice

[Operation and maintenance] Ansible, an automated operation and maintenance tool in practice

Ansible is a newly emerging automated operation and maintenance tool. It is developed based on Python and integrates the advantages of many operation and maintenance tools (puppet, cfengine, chef, func, fabric), and realizes functions such as batch system configuration, batch program deployment, and batch running commands.

Ansible works based on modules and does not have the ability to deploy in batches. The real batch deployment is the module run by ansible, and ansible just provides a framework. mainly includes:

  • Connection plugins: Responsible for communicating with the monitored terminal;
  • host inventory: the host for the specified operation, which is the host for monitoring defined in a configuration file;
  • Various modules core module, command module, custom module;
  • With the help of plug-ins, complete functions such as logging emails;
  • Playbook: When the script executes multiple tasks, it is not necessary to allow the node to run multiple tasks at once.

Want to master more details about ansible: Ansible, an automated operation and maintenance tool

ansible architecture:

Ansible features:

  • Modularization: call specific modules to complete specific tasks
  • There are three key modules: Paramiko, PyYAML, Jinja2 (template language)
  • Support custom modules
  • Based on Python language
  • Simple deployment, based on python and SSH (installed by default), agentless
  • Secure, based on OpenSSH
  • Support playbook scheduling tasks
  • Idempotence: the effect of executing a task 1 time is the same as executing n times, no accidents caused by repeated execution
  • No proxy and no dependence on PKI (no SSL required)
  • Modules can be written in any programming language
  • YAML format, schedule tasks, support rich data structure
  • More powerful multi-layer solution

How Ansible works:

  • The management end supports local, ssh, zeromq three ways to connect to the managed end, and the ssh-based connection is used by default-this part corresponds to the connection module in the basic architecture diagram
  • Host Inventory (host group) can be classified according to application types, etc. The management node implements corresponding operations through various modules-single module, single command batch execution, we can call it ad-hoc
  • The management node can implement a collection of multiple tasks through playbooks to achieve a class of functions, such as the installation and deployment of web services, and batch backup of database servers. For playbooks, we can simply understand that the system combines multiple configuration files for ad-hoc operations

More quality technical courses:

Alibaba Cloud University official website (Alibaba Cloud University-official website, innovative talent workshop under the cloud ecosystem )