当前位置:网站首页>Ansible installation and deployment of automated operation and maintenance
Ansible installation and deployment of automated operation and maintenance
2022-07-24 13:48:00 【Brother Xing plays with the clouds】
A preliminary understanding Ansible ansible be based on Python Development ,, It combines the advantages of many operation and maintenance tools , Realize the batch run command , The deployment process , Configure system and other functions . Default by SSH Protocol for remote command execution or distribution configuration , There is no need to deploy any client agent software , This makes automated environment deployment easier . It can support parallel management of multiple hosts at the same time , Make the management host more convenient .
Ansible Core components ansible It can be seen as a framework that works based on modules , Batch deployment capability means ansible The running module realizes . In short ansible Is based on “ modular ” Complete all kinds of “ Mission ” Of . The structure diagram is shown below
ansible The assembly consists of the following six parts Ansible core The core engine
Host inventory Host list : Used to define Ansible Managed hosts , The default is in Ansible Of hosts The managed host is defined in the configuration file , It also supports customizing the dynamic host list and specifying the location of other configuration files
Connection plugins Connect plug-ins : Responsible for communication with the managed host . In addition to support the use of SSH Connect outside the managed host ,ansible It also supports other connection methods , So we need to have a connection plug-in to connect each host to ansible
Playbooks(yam1,jinja2) Script : Used to centrally define ansible Task configuration file for , To define multiple tasks in a play by ansible Automatic execution , The control host can run multiple tasks for multiple managed hosts at the same time
Core modules Core module : yes ansible Built in modules , Use these modules to distribute resources to managed hosts , Make it perform specific tasks or match specific states
Custom modules Custom module : Supplement for completing module functions , Log can be completed with the help of related plug-ins , Send email and other functions
Installation and deployment ansible service ansible Automatic operation and maintenance The environment consists of the control host and the managed host , because ansible Is based on SSH Protocol for communication , So control the host installation ansible There is no need to restart or run any program after the software , The managed host does not need to install or run any agents .
The case environment is as follows :
1 install ansible You can use the source code to install , You can also use the operating system software package tool to install . What I'm using here is CentOS7 operating system , adopt yum Way to install ansible, Need to rely on a third party epel Source .
yum install epel-release -y
Download it yum After the source , You can use it directly yum Command to install ansible
yum install ansible -y
After installation, you can view ansible Software version information .
ansible --version ansible 2.7.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
ansible The main relevant configuration files are /etc/ansible Under the table of contents
cd /etc/ansible/ Total usage 24 -rw-r--r--. 1 root root 20269 10 month 9 09:34 ansible.cfg # The configuration file -rw-r--r--. 1 root root 1016 10 month 9 09:34 hosts # Control host files drwxr-xr-x. 2 root root 6 10 month 9 09:34 roles
2 Configure host list ansible By reading the default host list /etc/ansible/hosts file , After modifying the host and group configuration , It can be connected to multiple managed hosts at the same time to perform tasks . The specific configuration is as follows :
vim hosts [web] # Managed host classification 192.168.199.130 [mysql] # Managed host classification 192.168.199.131
3 Set up SSH Password-free login for fear of ansible Enter the password of the managed host when issuing instructions , You can sign the certificate to SSH Effect of login without password , Use ssh-keygen Generate a pair of keys , Use ssh-copy-id To issue the generated public key Close three The server The firewall of
systemctl stop firewalld.service setenforce 0
Configure secret key authentication
ssh-keygen -t rsa ssh-copy-id [email protected] ssh-copy-id [email protected]
Here we are ,ansible Your environment is deployed .
边栏推荐
猜你喜欢

网络安全——报错注入

Network security - filtering bypass injection

Kunyu(坤舆) 安装 详解

网络安全——Web渗透测试

Network security - function bypass injection

Network security - file upload blacklist bypass

论文笔记:Swin-Unet: Unet-like Pure Transformer for MedicalImage Segmentation

第六章 总线

Network security -- Service Vulnerability scanning and utilization

2021-07-09
随机推荐
[机缘参悟-51]:既然人注定要死亡,为什么还要活着?
使用树莓派做Apache2 HA实验
Interview question 01.02. determine whether it is character rearrangement
代码签名证书与SSL证书区别
Chapter VI bus
Flink综合案例(九)
网络安全——过滤绕过注入
Sringboot-plugin-framework 实现可插拔插件服务
No response to NPM instruction
游戏思考04总结:针对帧、状态、物理同步的总结(之前写的太长,现在简略下)
Exploration of sustainable learning ability to support the application of ecological evolution of Pengcheng series open source large models
申请了SSL数字证书如何进行域名验证?
论文笔记:Swin-Unet: Unet-like Pure Transformer for MedicalImage Segmentation
R语言使用epiDisplay包的tableStack函数制作统计汇总表格(基于目标变量分组的描述性统计、假设检验等)、设置by参数为目标变量、设置percent参数配置是否显示百分比信息
Flink高级特性和新特性(八)v2
关于不定方程解的个数的问题
The R language uses the DOTPLOT function of epidisplay package to visualize the frequency of data points in different intervals in the form of point graphs, uses the by parameter to specify the groupi
Nessus安全测试工具使用教程
XSS white list
Add an element to the object array with unshift