- 厨师教程
- 厨师 - 主页
- 厨师 - 概述
- 厨师 - 建筑
- Chef - 版本控制系统设置
- 厨师 - 工作站设置
- Chef - 客户端设置
- 厨师 - 测试厨房设置
- 厨师 - 刀具设置
- 厨师 - 独奏设置
- 厨师 - 食谱
- Chef - 食谱依赖项
- 厨师 - 角色
- 厨师 - 环境
- Chef - Chef-Client 作为守护进程
- 厨师 - Chef-Shell
- 厨师 - 测试食谱
- 厨师 - 美食评论家
- 厨师 - ChefSpec
- 使用测试厨房测试食谱
- 厨师 - 节点
- 厨师 - 厨师-客户运行
- 高级厨师
- 动态配置菜谱
- 厨师 - 模板
- Chef - 带有 Chef DSL 的纯 Ruby
- 厨师 - 红宝石宝石与食谱
- 厨师 - 图书馆
- 厨师 - 定义
- Chef - 环境变量
- 厨师 - 数据袋
- Chef - 数据包脚本
- Chef - 跨平台食谱
- 厨师 - 资源
- 轻量级资源提供者
- 厨师 - 蓝图
- Chef - 文件和包
- 厨师 - 社区食谱
- 厨师有用的资源
- 厨师 - 快速指南
- 厨师 - 有用的资源
- 厨师 - 讨论
厨师 - 食谱
Cookbook 是 Chef 的基本工作单元,由与工作单元相关的所有详细信息组成,能够修改配置为 Chef 基础设施上的节点的任何系统的配置和状态。食谱可以执行多项任务。食谱包含有关节点所需状态的值。这是通过使用所需的外部库在 Chef 中实现的。
食谱的关键组成部分
- 食谱
- 元数据
- 属性
- 资源
- 模板
- 图书馆
- 任何其他有助于创建系统的事情
创建一本食谱
有两种方法可以动态创建食谱。
- 使用厨师命令
- 使用刀具实用程序
使用 Chef 命令
要使用 Chef 命令创建空食谱,请运行以下命令。
C:\Users\vipinkumarm>chef generate cookbook <Cookbook Name> C:\Users\vipinkumarm>chef generate cookbook VTest Installing Cookbook Gems: Compiling Cookbooks... Recipe: code_generator::cookbook * directory[C:/Users/vipinkumarm/VTest] action create - create new directory C:/Users/vipinkumarm/VTest * template[C:/Users/vipinkumarm/VTest/metadata.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/metadata.rb - update content in file C:/Users/vipinkumarm/VTest/metadata.rb from none to 4b9435 (diff output suppressed by config) * template[C:/Users/vipinkumarm/VTest/README.md] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/README.md - update content in file C:/Users/vipinkumarm/VTest/README.md from none to 482077 (diff output suppressed by config) * cookbook_file[C:/Users/vipinkumarm/VTest/chefignore] action create - create new file C:/Users/vipinkumarm/VTest/chefignore - update content in file C:/Users/vipinkumarm/VTest/chefignore from none to 15fac5 (diff output suppressed by config) * cookbook_file[C:/Users/vipinkumarm/VTest/Berksfile] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/Berksfile - update content in file C:/Users/vipinkumarm/VTest/Berksfile from none to 9f08dc (diff output suppressed by config) * template[C:/Users/vipinkumarm/VTest/.kitchen.yml] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/.kitchen.yml - update content in file C:/Users/vipinkumarm/VTest/.kitchen.yml from none to 93c5bd (diff output suppressed by config) * directory[C:/Users/vipinkumarm/VTest/test/integration/default/serverspec] action create - create new directory C:/Users/vipinkumarm/VTest/test/integration/default/serverspec * directory[C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec] action create - create new directory C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec * cookbook_file [C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec/sp ec_helper.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec/spec_helper.rb - update content in file C:/Users/vipinkumarm/VTest/test/integration/helpers/serverspec/spec_helper.rb from none to d85df4 (diff output suppressed by config) * template [C:/Users/vipinkumarm/VTest/test/integration/default/serverspec/default _spec.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/test/integration/default/serverspec/default_spec.rb - update content in file C:/Users/vipinkumarm/VTest/test/integration/default/serverspec/default_spec.rb from none to 758b94 (diff output suppressed by config) * directory[C:/Users/vipinkumarm/VTest/spec/unit/recipes] action create - create new directory C:/Users/vipinkumarm/VTest/spec/unit/recipes * cookbook_file[C:/Users/vipinkumarm/VTest/spec/spec_helper.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/spec/spec_helper.rb - update content in file C:/Users/vipinkumarm/VTest/spec/spec_helper.rb from none to 587075 (diff output suppressed by config) * template[C:/Users/vipinkumarm/VTest/spec/unit/recipes/default_spec.rb] action create_if_missing - create new file C:/Users/vipinkumarm/VTest/spec/unit/recipes/default_spec.rb - update content in file C:/Users/vipinkumarm/VTest/spec/unit/recipes/default_spec.rb from none to 779503 (diff output suppressed by config) - create new file C:/Users/vipinkumarm/VTest/recipes/default.rb - update content in file C:/Users/vipinkumarm/VTest/recipes/default.rb from none to 8cc381 (diff output suppressed by config) * cookbook_file[C:/Users/vipinkumarm/VTest/.gitignore] action create - create new file C:/Users/vipinkumarm/VTest/.gitignore - update content in file C:/Users/vipinkumarm/VTest/.gitignore from none to 33d469 (diff output suppressed by config)
将在目录中创建名为 VTest 的说明书结构,以下是其结构。
使用刀具实用程序
使用以下命令使用 Knife 实用程序创建食谱。
C:\Users\vipinkumarm\VTest>knife cookbook create VTest2 WARNING: No knife configuration file found ** Creating cookbook VTest2 in C:/chef/cookbooks ** Creating README for cookbook: VTest2 ** Creating CHANGELOG for cookbook: VTest2 ** Creating metadata for cookbook: VTest2
以下是食谱的结构。