欢迎光临
我们一直在努力

4-ansible playbook结构图

1.ansible playbook结构图

Inventory(主机清单)

├── web
│ ├── 192.168.1.10
│ └── 192.168.1.11

└── db
└── 192.168.1.20

Playbook(剧本)

└── – Play(一个执行单元)

├── hosts: web
├── remote_user: root

└── tasks:

├── – Task
│ ├── name: Install nginx
│ └── yum:

├── – Task
│ ├── name: Copy config
│ └── copy:

└── – Task
├── name: Start nginx
└── service:

#说明:
1.Inventory 决定“有哪些机器”
2.hosts 决定“操作哪些机器”
3.tasks 决定“执行什么操作”
4.module 决定“如何执行操作”

2.对应的YAML

– hosts: web
remote_user: root

tasks:
– name: Install nginx
yum: #module
name: nginx #module-parameter
state: present #module-parameter

– name: Copy config
copy:
src: nginx.conf
dest:

赞(0)
未经允许不得转载:171主机测评 » 4-ansible playbook结构图
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址