当前位置:网站首页>1. Installation and deployment of asible
1. Installation and deployment of asible
2022-07-22 00:19:00 【More than less difference】
Asible Installation and deployment of
- One 、 Experimental environment
- One 、Ansible Great significance for enterprise operation and maintenance
- Two 、Ansible Installation
- 3、 ... and 、 structure Ansible detailed list
- Four 、Ansible Detailed explanation of configuration file parameters
- 5、 ... and 、 Build user level Ansible Operating environment
One 、 Experimental environment
Three hosts are needed , The configuration is as follows
Ansible host
To configure epel Source
node200 Host configuration
node20 Host configuration
One 、Ansible Great significance for enterprise operation and maintenance
Hosts in Enterprises , The number of systems to be controlled is certainly not unique , The number of servers to be controlled must be huge , Use traditional ssh It will be very troublesome to control . The software is also based on ssh, To complete one to many deployment . A tool for remote one to many management , Tools for automatic deployment .
Two 、Ansible Installation
For specific operation, please refer to the environment installation section
epel Source
dnf install ansible -y
ansible --vier** Bold style **sion
ansible Basic information of :
/etc/ansible/ansible.conf ## Global profile , The default is rarely modified
/etc/ansible/hosts # Global host manifest file
3、 ... and 、 structure Ansible detailed list
The list is ansible List of control hosts
/etc/ansible/hosts # Global manifest file
1. List view
ansible Group name in list [-i Inventory file ] --list-hosts
ansible ungrouped --list-hosts
ansible all --list-hosts
The list is not the list in the list group or the list not in the list group
2. Prepare list
1) Write default list
Single layer list
# Single layer list #
[westos]
172.25.254.200
172.25.254.20
[test1]
node200.westos.org
node20.westos.org
Nested list
[testall:children]
westos
test1
test ## 3) Scope operation of host specification
By specifying the host name or IP The scope of can be simplified Ansible Host list
# grammar :
#[start:end]
[westostest]
172.25.254.[10:20]
test
4) Specify other manifest files
## 4)ansible The command specifies the regular expression of the manifest
* ## all
##172.25.254.*
##westos*
: ## Logic or
##westos1:linux
##172.25.254.100:172.25.254.200
:& ## Logic and
##westos1:&linux
## The host is at westos1 The list is also here linux In the list
:! ## Logic is not
##westos1:!linux
## stay westos1 Not in linux in
~ ## Start with a keyword
~(str1|str2) ## On condition of 1 Or the conditions 2 start
Four 、Ansible Detailed explanation of configuration file parameters
Ansible Execute command format
ansible Group name in list -m modular -u remote_user #-u After remoute_user Refers to the identity of the remote user executing
1. Classification and priority of configuration files
/etc/ansible/ansible.cfg # Basic configuration file , No other configuration files were found. This file takes effect
~/.ansible.cfg # The user does not exist in the current directory ansible.cfg This document takes effect
./ansible.cfg In the user's current directory ansible.cfg The file has the highest priority
Solution
Profile priority
2. Common configuration parameters
[default] ## Basic information setting
inventory= ## Specify the manifest path
remote_user= ## The name of the user logged in on the managed host , The current user is not specified
ask_pass= ## Do you want to prompt for SSH password , If the public key login is set to false
library= ## Library file storage directory
local_tmp= ## Local temporary command execution Directory
remote_tmp= ## Remote host temporary py Command file storage directory
forks= ## Default concurrency number
host_key_checking= ## Whether to enter... When connecting to the managed host for the first time yes establish host_key
sudo_user= ## Default sudo user
ask_sudo_pass= ## Every time... Is performed on the controlled host ansible Whether to ask sudo password
module_name= ## Default module , By default command, It can be changed to shel
log_path= ## Log file path
[privilege_escalation] ## Identity settings
become= ## Whether to automatically switch users after connection
become_method= ## Set the way to switch users , Usually use sudo
become_user= ## The user to switch to in the managed host , Usually it is root
become_ask_pass ## Do you need to become_method Prompt for password , The default is false
In execution ansible When ordered , Is to generate a local python Script , And then through ssh Method is stored in a directory of the remote host , Then execute in the remote host .
Ansible The host is remotely connected to devops User identity execution useadd command
5、 ... and 、 Build user level Ansible Operating environment
Establish users in the controlled host devops, And set sudo jurisdiction
边栏推荐
- SQL summary data
- Encapsulation of virtual machine
- The danger of testing SQL | don't take it lightly
- regular expression
- ENSP configure DHCP
- Construction of CODIS cluster
- Leakage current, no grounding protection measures... 1296 imported electric kettle have major potential safety hazards
- 2.Ansible中常用模块
- 1.Asible的安装及部署
- Oracle中Drop Table之后想恢复?来看这里[只要二步]
猜你喜欢
Lamp Architecture - MySQL installation and deployment, MySQL Cluster and master-slave structure (1)
table表格
[rviz2] error occurs when importing URDF model: could not load resource XXX, unable to open file XXX, error retrieving file XXX
centos7部署mysql8
Analysis of cross apply and outer apply query of SQL Server - Part I
Peoplecode assigns values based on context references
Connections and differences between three-level dispatching
Navicat was selected into the "global database industry map" released by the Academy of information technology
JasperReports不兼容高版本itext引发的异常
Video 36 Chapter 13
随机推荐
Shell scripts download data by date range and interval
Piracy leads to device paralysis | official solemn statement: do not buy or download Navicat through unofficial channels
Atomic quotation to solve ABA problem
centos7部署mysql8
Migrate repo managed code to Gerrit
JasperReports配置中文字体
虚拟机的封装
The actual case of Cisco configuring single arm routing is very simple
什么是哈希冲突?哈希冲突怎么解决?
正则表达式
Peoplecode variable
Oracle中Drop Table之后想恢复?来看这里[只要二步]
Amazon cloud technology training and Certification Course in August is wonderful and can't be missed!
2022 latest Ningxia construction eight members (Electrical constructors) simulation question bank and answers
LNMP ------php7 installation
二叉树的先根,中根,后根遍历
Enterprises and individuals choose cloud terminals or cloud servers for cloud desktops? You will know after reading this article
Tcp/ip Foundation
Part 06: pooling Technology
Centos7 deploy mysql8