草庐IT

Ansible Playbook 讲解与实战操作

大数据老司机 2023-03-28 原文

一、概述

  • playbookad-hoc相比,是一种完全不同的运用ansible的方式,类似与saltstack的state状态文件。ad-hoc无法持久使用,playbook可以持久使用。
  • playbook是由一个或多个play组成的列表,play的主要功能在于将事先归并为一组的主机装扮成事先通过ansible中的task定义好的角色。
  • 从根本上来讲,所谓的task无非是调用ansible的一个module。将多个play组织在一个playbook中,即可以让它们联合起来按事先编排的机制完成某一任务。
参考文档:https://ansible-tran.readthedocs.io/en/latest/docs/playbooks.html

Ansible 的基础介绍和环境部署可以参考我这篇文章:Ansible 介绍与实战操作演示



二、playbook 核心元素

  • Hosts执行的远程主机列表
  • Tasks任务集
  • Varniables内置变量或自定义变量在playbook中调用
  • Templates模板,即使用模板语法的文件,比如配置文件等
  • Handlers和notity结合使用,由特定条件触发的操作,满足条件方才执行,否则不执行
  • Tags标签,指定某条任务执行,用于选择运行playbook中的部分代码。

三、playbook 语法(yaml)

  • playbook使用yaml语法格式,后缀可以是yaml,也可以是yml
  • YAML( /ˈjæməl/ )参考了其他多种语言,包括:XML、C语言、Python、Perl以及电子邮件格式RFC2822,Clark Evans在2001年5月在首次发表了这种语言,另外Ingy döt Net与OrenBen-Kiki也是这语言的共同设计者。
  • YAML格式是类似JSON的文件格式。YAML用于文件的配置编写,JSON多用于开发设计。

1)YAML 介绍

1、YAML 格式如下

  • 文件的第一行应该以“---”(三个连字符)开始,表明YAML文件的开始。
  • 在同一行中,#之后的内容表示注释,类似于shell,python和ruby。
  • YAML中的列表元素以“-”开头并且跟着一个空格。后面为元素内容。
  • 同一个列表之中的元素应该保持相同的缩进,否则会被当做错误处理。
  • play中hosts、variables、roles、tasks等对象的表示方法都是以键值中间以“:”分隔表示,并且“:”之后要加一个空格。
2、playbooks yaml配置文件解释
Hosts:运行指定任务的目标主机
remoute_user:在远程主机上执行任务的用户;
sudo_user:
tasks:任务列表

tasks的具体格式:

tasks:
- name: TASK_NAME
module: arguments
notify: HANDLER_NAME
handlers:
- name: HANDLER_NAME
module: arguments

##模块,模块参数:
格式如下:
(1)action: module arguments
(2) module: arguments
注意:shell和command模块后直接加命令,而不是key=value类的参数列表


handlers:任务,在特定条件下触发;接受到其他任务的通知时被触发;

3、示例

---
- hosts: web
remote_user: root
tasks:
- name: install nginx ##安装模块,需要在被控主机里加上nginx的源
yum: name=nginx state=present
- name: copy nginx.conf ##复制nginx的配置文件过去,需要在本机的/tmp目录下编辑nginx.conf
copy: src=/tmp/nginx.conf dest=/etc/nginx/nginx.conf backup=yes
notify: reload #当nginx.conf发生改变时,通知给相应的handlers
tags: reloadnginx #打标签
- name: start nginx service #服务启动模块
service: name=nginx state=started
tags: startnginx #打标签

handlers:
- name: reload
service: name=nginx state=restarted

2)variables 变量

variables变量有四种定义方法。如下:

1、facts:可以直接调用

ansible中有setup模块,这个模块就是通过facts组件来实现的,主要是节点本身的一个系统信息,bios信息,网络,硬盘等等信息。这里的variables也可以直接调用facts组件的facters我们可以使用setup模块来获取,然后直接放入我们的剧本之中调用即可。

ansible web -m setup

常用的几个参数:

ansible_all_ipv4_addresses # ipv4的所有地址
ansible_all_ipv6_addresses # ipv6的所有地址
ansible_date_time # 获取到控制节点时间
ansible_default_ipv4 # 默认的ipv4地址
ansible_distribution # 系统
ansible_distribution_major_version # 系统的大版本
ansible_distribution_version # 系统的版本号
ansible_domain #系统所在的域
ansible_env #系统的环境变量
ansible_hostname #系统的主机名
ansible_fqdn #系统的全名
ansible_machine #系统的架构
ansible_memory_mb #系统的内存信息
ansible_os_family # 系统的家族
ansible_pkg_mgr # 系统的包管理工具
ansible_processor_cores #系统的cpu的核数(每颗)
ansible_processor_count #系统cpu的颗数
ansible_processor_vcpus #系统cpu的总个数=cpu的颗数*CPU的核数
ansible_python # 系统上的python
搜索

ansible web -m setup -a 'filter=*processor*'

2、用户自定义变量

自定义变量有两种方式

  • 通过命令行传入
ansible-playbook命令行中的 -e VARS,--extra-vars VARS,这样就可以直接把自定义的变量传入
使用playbook定义变量,实例如下:

---
- hosts: web
remote_user: root
tasks:

- name: install {{ rpmname }}
yum: name={{ rpmname }} state=present
- name: copy {{ rpmname }}.conf
copy: src=/tmp/{{ rpmname }}.conf dest=/etc/{{ rpmname }}/{{ rpmname }}.conf backup=yes
notify: reload
tags: reload{{ rpmname }}
- name: start {{ rpmname }} service
service: name={{ rpmname }} state=started
tags: start{{ rpmname }}

handlers:
- name: reload
service: name={{ rpmname }} state=restarted
使用:

ansible-playbook nginx.yml -e rpmname=keepalived
ansible-playbook nginx.yml --extra-vars rpmname=keepalived
  • 在playbook中定义变量
##在playbook中定义变量如下:
vars:
- var1: value1
- var2: value2
使用:

---
- hosts: web
remote_user: root
vars:
- rpmname: keepalived
tasks:
- name: install {{ rpmname }}
yum: name={{ rpmname }} state=present
- name: copy {{ rpmname }}.conf
copy: src=/tmp/{{ rpmname }}.conf dest=/etc/{{ rpmname }}/{{ rpmname }}.conf backup=yes
notify: reload
tags: reload{{ rpmname }}
- name: start {{ rpmname }} service
service: name={{ rpmname }} state=started
tags: start{{ rpmname }}

handlers:
- name: reload
service: name={{ rpmname }} state=restarted

3、通过roles传递变量

下面介绍roles会使用roles传递变量,小伙伴可以翻到下面看详解讲解。

4、 Host Inventory

可以在主机清单中定义,方法如下:

#向不同的主机传递不同的变量
IP/HOSTNAME varaiable=value var2=value2

#向组中的主机传递相同的变量
[groupname:vars]
variable=value

3)流程控制

1、用when 来表示的条件判断

- hosts: web
remote_user: root#代表用root用户执行,默认是root,可以省略
tasks:
- name: createfile
copy: content="test3" dest=/opt/p1.yml
when: a=='3'
- name: createfile
copy: content="test4" dest=/opt/p1.yml
when: a=='4'
如果a"3",就将“test3”,写入到web组下被管控机的/opt/p1.yml中,
如果a"4",就将“test4”,写入到web组下被管控机的/opt/p1.yml中。

执行

# 语法校验
ansible-playbook --syntax-check p1.yml

#执行
ansible-playbook -e 'a="3"' p1.yml

2、标签(只执行配置文件中的一个任务)

- hosts: web
tasks:
- name: installnginx
yum: name=nginx
- name: copyfile
copy: src=/etc/nginx/nginx.conf dest=/etc/nginx/nginx.conf
tags: copyfile
- name: start
service: name=nginx static=restarted
执行

# 语法校验
ansible-playbook --syntax-check p2.yml

#执行
ansible-playbook -t copyfile p2.yml

3、循环 with_items

创建三个用户

- hosts: web
tasks:
- name: createruser
user: name={{ item }}
with_items:
- shy1
- shy2
- shy3
- name: creategroup
group: name={{ item }}
with_items:
- group1
- group2
- group3
执行

#语法校验
ansible-playbook --syntax-check p3.yml

#执行
ansible-playbook p3.yml

4、循环嵌套(字典)

用户shy1的属组是group1,用户shy2的属组是group2,用户shy3的属组是group3

- hosts: web
tasks:
- name: creategroup
group: name={{item}}
with_items:
- group3
- group4
- group5
- name: createuser
user: name={{item.user}} group={{item.group}}
with_items:
- {'user': shy3,'group': group3}
- {'user': shy4,'group': group4}
- {'user': shy5,'group': group5}
执行

#语法校验
ansible-playbook --syntax-check p4.yml

#执行
ansible-playbook p4.yml

4)模板 templates

  • 模板是一个文本文件,嵌套有脚本(使用模板编程语言编写)
  • Jinja2是python的一种模板语言,以Django的模板语言为原本
该模板支持:

字符串:使用单引号或双引号;
  数字:整数,浮点数;
  列表:[item1, item2, ...]
  元组:(item1, item2, ...)
  字典:{key1:value1, key2:value2, ...}
  布尔型:true/false
  算术运算:
    +, -, *, /, //, %, **
  比较操作:
    ==, !=, >, >=, <, <=
  逻辑运算:
    and, or, not
  • 通常模板都是通过引用变量来运用的
【示例】

1、定义模板

user nginx; #设置nginx服务的系统使用用户
worker_processes {{ ansible_processor_vcpus }}; #工作进程数

error_log /var/log/nginx/error.log warn; #nginx的错误日志
pid /var/run/nginx.pid; #nginx启动时候的pid

events {
worker_connections 1024; #每个进程允许的最大连接数
}

http { #http请求配置,一个http可以包含多个server

#定义 Content-Type
include /etc/nginx/mime.types;
default_type application/octet-stream;

#日志格式 此处main与access_log中的main对应
#$remote_addr:客户端地址
#$remote_user:http客户端请求nginx认证的用户名,默认不开启认证模块,不会记录
#$timelocal:nginx的时间
#$request:请求method + 路由 + http协议版本
#status:http reponse 状态码
#body_bytes_sent:response body的大小
#$http_referer:referer头信息参数,表示上级页面
#$http_user_agent:user-agent头信息参数,客户端信息
#$http_x_forwarded_for:x-forwarded-for头信息参数
log_format main '$http_user_agent' '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

#访问日志,后面的main表示使用log_format中的main格式记录到access.log
access_log /var/log/nginx/access.log main;

#nginx的一大优势,高效率文件传输
sendfile on;
#tcp_nopush on;

#客户端与服务端的超时时间,单位秒
keepalive_timeout 65;

#gzip on;
server { #http服务,一个server可以配置多个location
listen {{ nginxport }}; #服务监听端口
server_name localhost; #主机名、域名

#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;

location / {
root /usr/share/nginx/html; #页面存放目录
index index.html index.htm; #默认页面
}

#error_page 404 /404.html;

# 将500 502 503 504的错误页面重定向到 /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html { #匹配error_page指定的页面路径
root /usr/share/nginx/html; #页面存放的目录
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
include /etc/nginx/conf.d/*.conf;
}

2、定义yaml编排

---
- hosts: web
remote_user: root
vars:
- rpmname: nginx
- nginxport: 8088
tasks:
- name: install {{ rpmname }}
yum: name={{ rpmname }} state=present
- name: copy {{ rpmname }}.conf
copy: src=/tmp/{{ rpmname }}.conf dest=/etc/{{ rpmname }}/{{ rpmname }}.conf backup=yes
notify: reload
tags: reload{{ rpmname }}
- name: start {{ rpmname }} service
service: name={{ rpmname }} state=started
tags: start{{ rpmname }}

handlers:
- name: reload
service: name={{ rpmname }} state=restarted
使用

##使用reloadnginx标签,重新加载剧本
copy与template的区别

  • copy模块不替代参数,template模块替代参数
  • template的参数几乎与copy的参数完全相同

5)handlers(触发事件)

notify:触发
handlers:触发的动作
使用上场景:修改配置文件时

【示例】 正常情况时handlers是不会执行的

- hosts: web
tasks:
- name: installredis
yum: name=redis
- name: copyfile
template: src=redis.conf dest=/etc/redis.conf
tags: copyfile
notify: restart
- name: start
service: name=redis state=started
handlers:
- name: restart
service: name=redis
执行

ansible-playbook -t copyfile p6.yml

6)roles

1、roles介绍与优势

一般情况下将roles写在/etc/ansible/roles中,也可以写在其他任意位置(写在其他位置要自己手动建立一个roles文件夹)

  • 对于以上所有方式有个缺点就是无法实现同时部署web、database、keepalived等不同服务或者不同服务器组合不同的应用就需要写多个yaml文件,很难实现灵活的调用
  • roles用于层次性,结构化地组织playbook。roles能够根据层次结果自动装载变量文件、tasks以及handlers等。
  • 要使用roles只需要在playbook中使用include指令即可。
  • 简单来讲,roles就是通过分别将变量(vars)、文件(files)、任务(tasks)、模块(modules)以及处理器(handlers)放置于单独的目录中,并且可以便捷的include它们地一种机制。
  • 角色一般用于基于主机构建服务的场景中,但是也可以用于构建守护进程等场景中。4

2、目录结构

创建目录

mkdir -pv ./{nginx,mysql,httpd}/{files,templates,vars,tasks,handlers,meta,default}

  • roles/
  • mysql/:mysql服务的yml文件
  • httpd/:apached服务的yml文件
  • nginx/:nginx服务的yml文件
  • files/:存储由copy或者script等模块调用的文件或者脚本;
  • tasks/:此目录中至少应该有一个名为main.yml的文件,用于定义各个task;其他文件需要由main.yml进行包含调用;
  • handlers/:此目录中至少应该有一个名为main.yml的文件,用于定义各个handler;其他文件需要由main.yml进行包含调用;
  • vars/:此目录至少应该有一个名为main,yml的文件,用于定义各个variable;其他的文件需要由main.yml进行包含调用;
  • templates/:存储由templates模块调用的模板文件;
  • meta/:此目录中至少应该有一个名为main.yml的文件,定义当前角色的特殊设定以及依赖关系,其他文件需要由main.yml进行包含调用;
  • default/:此目录至少应该有一个名为main.yml的文件,用于设定默认变量;

3、实战操作

【1】创建目录

mkdir -pv ./{nginx,mysql,httpd}/{files,templates,vars,tasks,handlers,meta,default}
【2】定义配置文件

先下载nginx rpm部署包

# 下载地址:http://nginx.org/packages/centos/7/x86_64/RPMS/
wget http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.18.0-1.el7.ngx.x86_64.rpm -O nginx/files/nginx-1.18.0-1.el7.ngx.x86_64.rpm
  • nginx/tasks/main.yml
- name: cp
copy: src=nginx-1.18.0-1.el7.ngx.x86_64.rpm dest=/tmp/nginx-1.18.0-1.el7.ngx.x86_64.rpm
- name: install
yum: name=/tmp/nginx-1.18.0-1.el7.ngx.x86_64.rpm state=latest
- name: conf
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf
tags: nginxconf
notify: new conf to reload
- name: start service
service: name=nginx state=started enabled=true
  • nginx/templates/nginx.conf.j2
user nginx; #设置nginx服务的系统使用用户
worker_processes {{ ansible_processor_vcpus }}; #工作进程数

error_log /var/log/nginx/error.log warn; #nginx的错误日志
pid /var/run/nginx.pid; #nginx启动时候的pid

events {
worker_connections 1024; #每个进程允许的最大连接数
}

http { #http请求配置,一个http可以包含多个server

#定义 Content-Type
include /etc/nginx/mime.types;
default_type application/octet-stream;

#日志格式 此处main与access_log中的main对应
#$remote_addr:客户端地址
#$remote_user:http客户端请求nginx认证的用户名,默认不开启认证模块,不会记录
#$timelocal:nginx的时间
#$request:请求method + 路由 + http协议版本
#status:http reponse 状态码
#body_bytes_sent:response body的大小
#$http_referer:referer头信息参数,表示上级页面
#$http_user_agent:user-agent头信息参数,客户端信息
#$http_x_forwarded_for:x-forwarded-for头信息参数
log_format main '$http_user_agent' '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

#访问日志,后面的main表示使用log_format中的main格式记录到access.log
access_log /var/log/nginx/access.log main;

#nginx的一大优势,高效率文件传输
sendfile on;
#tcp_nopush on;

#客户端与服务端的超时时间,单位秒
keepalive_timeout 65;

#gzip on;
server { #http服务,一个server可以配置多个location
listen {{ nginxport }}; #服务监听端口
server_name localhost; #主机名、域名

#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;

location / {
root /usr/share/nginx/html; #页面存放目录
index index.html index.htm; #默认页面
}

#error_page 404 /404.html;

# 将500 502 503 504的错误页面重定向到 /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html { #匹配error_page指定的页面路径
root /usr/share/nginx/html; #页面存放的目录
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
include /etc/nginx/conf.d/*.conf;
}
  • nginx/vars/main.yml
nginxport: 9999
  • nginx/handlers/main.yml
- name: new conf to reload
service: name=nginx state=restarted
  • 定义剧本文件(roles.yml
- hosts: web
remote_user: root
roles:
- nginx
最后的目录结构如下:

执行

ansible-playbook roles.yml


有关Ansible Playbook 讲解与实战操作的更多相关文章

  1. 世界前沿3D开发引擎HOOPS全面讲解——集3D数据读取、3D图形渲染、3D数据发布于一体的全新3D应用开发工具 - 2

    无论您是想搭建桌面端、WEB端或者移动端APP应用,HOOPSPlatform组件都可以为您提供弹性的3D集成架构,同时,由工业领域3D技术专家组成的HOOPS技术团队也能为您提供技术支持服务。如果您的客户期望有一种在多个平台(桌面/WEB/APP,而且某些客户端是“瘦”客户端)快速、方便地将数据接入到3D应用系统的解决方案,并且当访问数据时,在各个平台上的性能和用户体验保持一致,HOOPSPlatform将帮助您完成。利用HOOPSPlatform,您可以开发在任何环境下的3D基础应用架构。HOOPSPlatform可以帮您打造3D创新型产品,HOOPSSDK包含的技术有:快速且准确的CAD

  2. 微信小程序开发入门与实战(Behaviors使用) - 2

    @作者:SYFStrive @博客首页:HomePage📜:微信小程序📌:个人社区(欢迎大佬们加入)👉:社区链接🔗📌:觉得文章不错可以点点关注👉:专栏连接🔗💃:感谢支持,学累了可以先看小段由小胖给大家带来的街舞👉微信小程序(🔥)目录自定义组件-behaviors    1、什么是behaviors    2、behaviors的工作方式    3、创建behavior    4、导入并使用behavior    5、behavior中所有可用的节点    6、同名字段的覆盖和组合规则总结最后自定义组件-behaviors    1、什么是behaviorsbehaviors是小程序中,用于实现

  3. ruby - 如何使用 Selenium Webdriver 根据 div 的内容执行操作? - 2

    我有一个使用SeleniumWebdriver和Nokogiri的Ruby应用程序。我想选择一个类,然后对于那个类对应的每个div,我想根据div的内容执行一个Action。例如,我正在解析以下页面:https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=puppies这是一个搜索结果页面,我正在寻找描述中包含“Adoption”一词的第一个结果。因此机器人应该寻找带有className:"result"的div,对于每个检查它的.descriptiondiv是否包含单词“adoption

  4. ruby-on-rails - 如何处理 Grape 中特定操作的过滤器之前? - 2

    我正在我的Rails项目中安装Grape以构建RESTfulAPI。现在一些端点的操作需要身份验证,而另一些则不需要身份验证。例如,我有users端点,看起来像这样:moduleBackendmoduleV1classUsers现在如您所见,除了password/forget之外的所有操作都需要用户登录/验证。创建一个新的端点也没有意义,比如passwords并且只是删除password/forget从逻辑上讲,这个端点应该与用户资源。问题是Grapebefore过滤器没有像except,only这样的选项,我可以在其中说对某些操作应用过滤器。您通常如何干净利落地处理这种情况?

  5. ruby-on-rails - 在 Ruby on Rails 中发送响应之前如何等待多个异步操作完成? - 2

    在我做的一些网络开发中,我有多个操作开始,比如对外部API的GET请求,我希望它们同时开始,因为一个不依赖另一个的结果。我希望事情能够在后台运行。我找到了concurrent-rubylibrary这似乎运作良好。通过将其混合到您创建的类中,该类的方法具有在后台线程上运行的异步版本。这导致我编写如下代码,其中FirstAsyncWorker和SecondAsyncWorker是我编写的类,我在其中混合了Concurrent::Async模块,并编写了一个名为“work”的方法来发送HTTP请求:defindexop1_result=FirstAsyncWorker.new.async.

  6. ruby - 在 Ruby 中是否有一种惯用的方法来操作 2 个数组? - 2

    a=[3,4,7,8,3]b=[5,3,6,8,3]假设数组长度相同,是否有办法使用each或其他一些惯用方法从两个数组的每个元素中获取结果?不使用计数器?例如获取每个元素的乘积:[15,12,42,64,9](0..a.count-1).eachdo|i|太丑了...ruby1.9.3 最佳答案 使用Array.zip怎么样?:>>a=[3,4,7,8,3]=>[3,4,7,8,3]>>b=[5,3,6,8,3]=>[5,3,6,8,3]>>c=[]=>[]>>a.zip(b)do|i,j|c[[3,5],[4,3],[7,6],

  7. ruby-on-rails - 如何让 Rails View 返回其关联的操作名称? - 2

    我有一个非常简单的Controller来管理我的Rails应用程序中的静态页面:classPagesController我怎样才能让View模板返回它自己的名字,这样我就可以做这样的事情:#pricing.html.erb#-->"Pricing"感谢您的帮助。 最佳答案 4.3RoutingParametersTheparamshashwillalwayscontainthe:controllerand:actionkeys,butyoushouldusethemethodscontroller_nameandaction_nam

  8. 100个python算法超详细讲解:画直线 - 2

    1.问题描述使用Python的turtle(海龟绘图)模块提供的函数绘制直线。2.问题分析一幅复杂的图形通常都可以由点、直线、三角形、矩形、平行四边形、圆、椭圆和圆弧等基本图形组成。其中的三角形、矩形、平行四边形又可以由直线组成,而直线又是由两个点确定的。我们使用Python的turtle模块所提供的函数来绘制直线。在使用之前我们先介绍一下turtle模块的相关知识点。turtle模块提供面向对象和面向过程两种形式的海龟绘图基本组件。面向对象的接口类如下:1)TurtleScreen类:定义图形窗口作为绘图海龟的运动场。它的构造器需要一个tkinter.Canvas或ScrolledCanva

  9. Postman测试简单操作 - 2

    1、接口请求基本操作1.1例子tips在view的选项可以zoomin调整窗口字帖大小。1、创建一个测试的workspace,并命名为test2、test后面新增一个addrequest3、选择发送GET,URL为一个开源的https://api.apiopen.top/api/sentences获取每日一句4、点击send查看内容Tips:如果提示出现Error:tunnelingsocketcouldnotbeestablished,statusCode=407错误,参照以下解决办法)关于tunnelingsocketcouldnotbeestablished,cause=getaddri

  10. 【Linux操作系统】——网络配置与SSH远程 - 2

    Linux操作系统——网络配置与SSH远程安装完VMware与系统后,需要进行网络配置。第一个目标为进行SSH连接,可以从本机到VMware进行文件传送,首先需要进行网络配置。1.下载远程软件首先需要先下载安装一款远程软件:FinalShell或者xhell7FinalShellxhell7FinalShell下载:Windows下载http://www.hostbuf.com/downloads/finalshell_install.exemacOS下载http://www.hostbuf.com/downloads/finalshell_install.pkg2.配置CentOS网络安装好

随机推荐