Introduction and characteristics of common automated operation and maintenance tools, installation of ansible

Introduction and characteristics of common automated operation and maintenance tools, installation of ansible

1. What is automated operation and maintenance?

To put it simply, automated operation and maintenance is to automate daily repetitive work within a certain time frame according to pre-set rules without human participation.

Periodic, repetitive, and regular tasks are all handed over to tools. Specifically, there are three aspects: application system maintenance automation, inspection automation, and fault handling automation. Automated operation and maintenance depends on a specific intelligent management platform, and ultimately achieves the purpose of improving operation and maintenance efficiency.

Automate the daily and a large number of repetitive tasks in IT operation and maintenance, and transform the manual execution in the past into automated operations. Automation is the sublimation of IT operation and maintenance. IT operation and maintenance automation is not only a maintenance process, but also a management improvement process. It is the highest level of IT operation and maintenance and is also the future development trend.

2. What are the commonly used automated operation and maintenance tools?

1. Puppet

Puppet is an early automated operation and maintenance tool for Linux. It is a centralized configuration management system for LINUX, WINDOWS, and UNIX platforms. It is now very mature and can manage remote servers in batches. It has rich modules and complex configurations. It is written based on Ruby language. It is the most typical C/S structure, which needs to install the server and client.

Puppet adopts a C/S star structure. All clients interact with one or more servers. Each client periodically (half an hour by default) sends a request to the server to obtain the latest configuration information and ensure synchronization with the configuration information.

Each Puppet client connects to the server periodically, downloads the latest configuration file, and configures the client strictly according to the configuration file. After the configuration is complete, the Puppet client can feed back a message to the server, and if an error occurs, it will also feed back a message to the server. Puppet is suitable for the entire process of server administration, such as initial installation, configuration, updates, etc.

features

  • high stability
  • Rich modules

2. Salt stack

Saltstack, like Puppet, is also a C/S model. It needs to install a server and a client. It is written based on Python, and MQ message synchronization is added, so that the execution command and execution results can be returned efficiently, but the execution process needs to wait for all clients to return. If the client does not return in time or respond, it may cause some machines to fail to execute results.

features

  • C/S architecture configuration management tool developed based on python
  • The bottom layer uses ZeroMQ message queue pub/sub communication
  • Use the way of SSL certificate issuance for authentication management, and the transmission adopts AES encryption

3. Ansible

Ansible, like SaltStack, is developed based on Python. Ansible only needs to run on an ordinary server, and there is no need to install a client on the client server. Because Ansible is based on SSH remote management, and most Linux servers are inseparable from SSH, Ansible does not need to add additional support for configuration.

Ansible is very easy to install and use, and based on thousands of plug-ins and modules, it realizes the management of various software, platforms, and versions, and supports multi-level deployment of virtual containers.

features

  • easy to deploy
  • By default, the SSH protocol is used to manage the device
  • There are a large number of routine operation and maintenance operation modules, which can meet most of the daily operation needs
  • Simple configuration, powerful functions and strong scalability
  • Supports API and custom modules, and can be easily extended through Python
  • Customize powerful configuration and status management through playbooks

3. What is Ansible?

Ansible is an automated operation and maintenance tool, developed based on Python, which 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 operation commands.

Ansible works based on modules and does not have the ability to deploy in batches. What really has batch deployment is the module that Ansible runs, and Ansible just provides a framework. It mainly includes:
(1) connection plugins: responsible for communicating with the monitored end;
(2) host inventory: the host for the specified operation, which is a host defined in a configuration file for monitoring; (3
) core modules, command modules, and custom modules of various modules;
(4) recording log emails and other functions with the help of plug-ins
;

Four, Ansible way

Ansible is designed with tools that are easy to use, automation that is easy to write and read. So we should aim for simplicity when creating automation.

The Ansible automation language is built around declarative text files that are easy to read. A properly written Ansible Playbook clearly documents your job automation.

Ansible is a requirements state engine. It solves the problem of how to automate IT deployment by expressing what state you want the system to be in. The goal of Ansible is to bring the system into the desired state by making only the necessary changes. Trying to think of Ansible as a scripting language is not the right way to go.

5. Install Ansible

1. Control node

Ansible is easy to install. Ansible software only needs to be installed on the control node (or nodes) on which it will run. Hosts managed by Ansible do not require Ansible to be installed.

Requirements for control nodes:

  • The control node should be Linux or UNIX system. Windows is not supported as a control node, but a Windows system can be a managed host.
  • The control node needs to install Python3 (version 3.5 or above) or Python2 (version 2.7 or above).

If the operating system is Red Hat 8.0, Ansible 2.9 can automatically use the platform-python package, which supports system utilities using Python. You don't need to install python37 or python27 packages from AppStream.

[root@localhost ~]# yum list installed platform-python                                                                                                      
Repository AppStream is listed more than once in the configuration
Installed Packages
platform-python.x86_64                                                         3.6.8-45.el8                                                         @anaconda

2. Managed host

One of the great things about Ansible is that managed hosts don't need special agents installed. Ansible control nodes use standard network protocols to connect managed hosts to ensure that the system is in a specified state.

Managed hosts may have certain requirements, depending on how the Control Node connects to them and which modules they want to run.

Linux and UNIX managed hosts require Python2 (version 2.6 or later) or Python3 (version 3.5 or later) installed in order to run most modules.

For Red Hat 8, you can enable and install python36 application stream (or python27 application stream)

yum module install python36

If SELinux is enabled on the managed host, you also need to ensure that the python3-libselinux package is installed before you can use modules related to any copy, file or templating functionality. So when working, you should turn off the SELinux function.

3. Install Ansible

//配置yum源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo 
[root@localhost ~]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# dnf list all | grep ansible   
Repository AppStream is listed more than once in the configuration
ansible-collection-microsoft-sql.noarch                1.1.0-1.el8                                            AppStream 
ansible-collection-redhat-rhel_mgmt.noarch             1.0.0-2.el8                                            AppStream 
ansible-freeipa.noarch                                 0.3.8-1.el8                                            AppStream 
ansible-freeipa-tests.noarch                           0.3.8-1.el8                                            AppStream 
ansible-pcp.noarch                                     2.2.1-1.el8                                            AppStream 
centos-release-ansible-29.noarch                       1-2.el8                                                extras    

[root@localhost ~]# dnf -y install centos-release-ansible-29

//安装ansible
[root@localhost ~]# dnf -y install ansible
[root@localhost ~]# ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Jan 19 2022, 23:28:49) [GCC 8.5.0 20210514 (Red Hat 8.5.0-7)]
  
//通过使用setup模块验证localhost上的ansible_python_version
[root@localhost ~]# ansible localhost -m setup | grep ansible_python_version
        "ansible_python_version": "3.6.8",

Guess you like

Origin blog.csdn.net/qq_65998623/article/details/127408166