当前位置:网站首页>ansible playbook语法和格式 自动化云计算
ansible playbook语法和格式 自动化云计算
2022-04-23 09:56:00 【数据库从删库到跑路】
YAML(yml)语言: (jinia2模板)
1) playbook是由yml语法书写, 结构清晰, 可读性强, 所以必须掌握yml基础语法
2) 缩进: YAML使用固定的缩进风格表示层级结构, 每个缩进由两个空格组成,不能使用tabs
3) 冒号: 以冒号结尾的除外, 其他所有冒号后面所有必须有空格
4) 短横线: 表示列表项, 使用一个短横杠加一个空格. 多个项使用同样的缩进级别作为同一列表
同样功能的模块 必须在同一级 严格对齐:
1) 剧本名字
- name: 剧本的名字或提示 中文或英文均可 (ansible-play时终端提示)
比如:
- name: install httpd and create vhost
- name: 安装http并配置虚拟主机
2) 对哪些主机进行操作
hosts: group1 (要对哪些主机进行操作 主机清单 /etc/ansible/inventory中定义 [此方括号中定义的名字])
3) 调用哪些模块, 要做哪些操作, 一项或多项任务 tasks (安装配置 配置主机 重启服务)
yum: 安装httpd
file: 删除文件 /etc/httpd/conf.d/welcome.conf
file: 创建目录 /data/web
copy: 生成主页内容
template: 创建虚拟主机
service: 重启服务
版权声明
本文为[数据库从删库到跑路]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_60655253/article/details/124274766
边栏推荐
- ABAP implementation publishes restful services for external invocation example
- ABAP publishes OData service samples from CDs view
- SAP ECC connecting SAP pi system configuration
- DBA常用SQL语句 (5) - Latch 相关
- Sim Api User Guide(8)
- PHP two-dimensional array specifies that the elements are added after they are equal, otherwise new
- 第二章 Oracle Database In-Memory 体系结构(上) (IM-2.1)
- Amazon cloud technology entry Resource Center, easy access to the cloud from 0 to 1
- DBA常用SQL语句(3)- cache、undo、索引和等待事件
- 云身份过于宽松,为攻击者打开了大门
猜你喜欢

Leetcode question bank 78 Subset (recursive C implementation)

NEC infrared remote control coding description

Comparative analysis of meta universe from the dimension of knowledge dissemination

《Redis设计与实现》

SAP pi / PO soap2proxy consumption external WS example

Construire neuf capacités de fabrication agile à l'ère métacosmique

C语言:表达式求值(整型提升、算术转换 ...)

Yarn资源调度器

Redis 异常 read error on connection 解决方案

【无标题】
随机推荐
SAP pi / PO function operation status monitoring and inspection
Educational Codeforces Round 81 (Rated for Div. 2)
AI上推荐 之 MMOE(多任务yyds)
ABAP implementation publishes restful services for external invocation example
Example of data object mask used by SAP translate
PHP two-dimensional array specifies that the elements are added after they are equal, otherwise new
Golang force buckle leetcode 396 Rotation function
MapReduce计算流程详解
DBA常用SQL语句(4)- Top SQL
Explanation of order and primitive root of number theory
元宇宙时代的职业规划与执行
从知识传播的维度对比分析元宇宙
[COCI] Vje š TICA (subset DP)
通过流式数据集成实现数据价值(4)-流数据管道
Classic routine: DP problem of a kind of string counting
DBA常用SQL语句(3)- cache、undo、索引和等待事件
ABAP CDs view with association example
art-template 模板引擎
防疫登记小程序
GCD of p2257 YY (Mobius inversion)