You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/recipes_yaml.md
+6-19Lines changed: 6 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,23 +53,7 @@ To create a YAML recipe, follow these steps:
53
53
54
54
Chef Infra supports YAML recipes with both `.yml` and `.yaml` extensions.
55
55
56
-
1. Define your recipe using the following structure.
57
-
It must have a top-level `resources` key containing an array of resource declarations. For example:
58
-
59
-
```yaml
60
-
---
61
-
resources:
62
-
- type: "resource_type"
63
-
name: "resource_name"
64
-
property1: value1
65
-
property2: value2
66
-
- type: "another_resource_type"
67
-
name: "another_resource_name"
68
-
property1: value1
69
-
property2: value2
70
-
```
71
-
72
-
1. Declare each resource as an array that defines the following:
56
+
1. Define your recipe with a top-level `resources` key containing an array of resources where each item has the following:
73
57
74
58
-`type`: The Chef resource type (string)
75
59
-`name`: The resource name/identifier (string)
@@ -88,7 +72,10 @@ To create a YAML recipe, follow these steps:
88
72
action: ["enable", "start"]
89
73
```
90
74
91
-
In this example, the [`package` resource]({{< relref "/resources/package/" >}}) uses the `install` action to install Nginx version 1.18.0 and the [`service` resource]({{< relref "/resources/service/" >}}) uses the `enable` and `start` actions to start up Nginx.
75
+
In this example:
76
+
77
+
- the [`package` resource]({{< relref "/resources/package/" >}}) uses the `install` action and the `version` property to install Nginx 1.18.0.
78
+
- the [`service` resource]({{< relref "/resources/service/" >}}) uses the `enable` and `start` actions to enable and start up Nginx.
92
79
93
80
## Examples
94
81
@@ -264,7 +251,7 @@ resources:
264
251
name: "/tmp/file2.txt"
265
252
```
266
253
267
-
Chef Infra Client returns the following error with multiple documents:
254
+
Chef Infra Client returns the following error with multiple documents in one file:
268
255
269
256
```text
270
257
ArgumentError: YAML recipe 'recipes/default.yml' contains multiple documents, only one is supported
0 commit comments