ridley 0.10.2 → 0.11.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +147 -216
- data/lib/ridley.rb +2 -0
- data/lib/ridley/bootstrap_bindings/unix_template_binding.rb +21 -25
- data/lib/ridley/bootstrap_bindings/windows_template_binding.rb +29 -34
- data/lib/ridley/bootstrapper.rb +2 -2
- data/lib/ridley/bootstrapper/context.rb +5 -5
- data/lib/ridley/chef.rb +0 -1
- data/lib/ridley/chef/cookbook.rb +0 -9
- data/lib/ridley/chef_object.rb +128 -0
- data/lib/ridley/chef_objects.rb +3 -0
- data/lib/ridley/chef_objects/client_object.rb +55 -0
- data/lib/ridley/chef_objects/cookbook_object.rb +190 -0
- data/lib/ridley/chef_objects/data_bag_item_obect.rb +104 -0
- data/lib/ridley/chef_objects/data_bag_object.rb +31 -0
- data/lib/ridley/chef_objects/environment_object.rb +59 -0
- data/lib/ridley/chef_objects/node_object.rb +161 -0
- data/lib/ridley/chef_objects/role_object.rb +62 -0
- data/lib/ridley/chef_objects/sandbox_object.rb +58 -0
- data/lib/ridley/client.rb +76 -45
- data/lib/ridley/connection.rb +1 -1
- data/lib/ridley/errors.rb +8 -1
- data/lib/ridley/host_connector.rb +26 -6
- data/lib/ridley/host_connector/ssh.rb +3 -3
- data/lib/ridley/host_connector/ssh/worker.rb +7 -9
- data/lib/ridley/host_connector/winrm/worker.rb +4 -5
- data/lib/ridley/mixin/bootstrap_binding.rb +1 -12
- data/lib/ridley/resource.rb +51 -171
- data/lib/ridley/resources/client_resource.rb +18 -68
- data/lib/ridley/resources/cookbook_resource.rb +181 -381
- data/lib/ridley/resources/data_bag_item_resource.rb +55 -161
- data/lib/ridley/resources/data_bag_resource.rb +20 -61
- data/lib/ridley/resources/environment_resource.rb +9 -64
- data/lib/ridley/resources/node_resource.rb +135 -311
- data/lib/ridley/resources/role_resource.rb +1 -57
- data/lib/ridley/resources/sandbox_resource.rb +80 -65
- data/lib/ridley/resources/search_resource.rb +99 -0
- data/lib/ridley/sandbox_uploader.rb +12 -52
- data/lib/ridley/version.rb +1 -1
- data/spec/acceptance/bootstrapping_spec.rb +1 -1
- data/spec/acceptance/client_resource_spec.rb +15 -37
- data/spec/acceptance/data_bag_item_resource_spec.rb +8 -14
- data/spec/acceptance/data_bag_resource_spec.rb +1 -1
- data/spec/acceptance/environment_resource_spec.rb +13 -22
- data/spec/acceptance/node_resource_spec.rb +10 -29
- data/spec/acceptance/role_resource_spec.rb +14 -13
- data/spec/acceptance/sandbox_resource_spec.rb +2 -2
- data/spec/support/shared_examples/ridley_resource.rb +2 -23
- data/spec/unit/ridley/bootstrap_bindings/unix_template_binding_spec.rb +3 -4
- data/spec/unit/ridley/bootstrap_bindings/windows_template_binding_spec.rb +3 -5
- data/spec/unit/ridley/bootstrapper/context_spec.rb +2 -3
- data/spec/unit/ridley/bootstrapper_spec.rb +1 -1
- data/spec/unit/ridley/chef_object_spec.rb +240 -0
- data/spec/unit/ridley/chef_objects/client_object_spec.rb +11 -0
- data/spec/unit/ridley/chef_objects/cookbook_object_spec.rb +93 -0
- data/spec/unit/ridley/chef_objects/data_bag_item_object_spec.rb +74 -0
- data/spec/unit/ridley/chef_objects/data_bag_object_spec.rb +9 -0
- data/spec/unit/ridley/chef_objects/environment_object_spec.rb +57 -0
- data/spec/unit/ridley/chef_objects/node_object_spec.rb +252 -0
- data/spec/unit/ridley/chef_objects/role_object_spec.rb +57 -0
- data/spec/unit/ridley/chef_objects/sandbox_object_spec.rb +66 -0
- data/spec/unit/ridley/client_spec.rb +51 -51
- data/spec/unit/ridley/host_connector/ssh/worker_spec.rb +4 -4
- data/spec/unit/ridley/host_connector/ssh_spec.rb +26 -24
- data/spec/unit/ridley/host_connector/winrm/worker_spec.rb +3 -4
- data/spec/unit/ridley/host_connector/winrm_spec.rb +4 -4
- data/spec/unit/ridley/host_connector_spec.rb +40 -3
- data/spec/unit/ridley/mixin/bootstrap_binding_spec.rb +1 -1
- data/spec/unit/ridley/resource_spec.rb +81 -109
- data/spec/unit/ridley/resources/client_resource_spec.rb +18 -33
- data/spec/unit/ridley/resources/cookbook_resource_spec.rb +56 -230
- data/spec/unit/ridley/resources/data_bag_item_resource_spec.rb +2 -57
- data/spec/unit/ridley/resources/data_bag_resource_spec.rb +12 -7
- data/spec/unit/ridley/resources/environment_resource_spec.rb +10 -118
- data/spec/unit/ridley/resources/node_resource_spec.rb +83 -394
- data/spec/unit/ridley/resources/role_resource_spec.rb +2 -56
- data/spec/unit/ridley/resources/sandbox_resource_spec.rb +139 -136
- data/spec/unit/ridley/resources/search_resource_spec.rb +234 -0
- data/spec/unit/ridley/sandbox_uploader_spec.rb +13 -58
- metadata +36 -17
- data/lib/ridley/chef/chefignore.rb +0 -76
- data/lib/ridley/resources/encrypted_data_bag_item_resource.rb +0 -55
- data/lib/ridley/resources/search.rb +0 -101
- data/spec/fixtures/chefignore +0 -8
- data/spec/unit/ridley/chef/chefignore_spec.rb +0 -40
- data/spec/unit/ridley/resources/search_spec.rb +0 -221
data/README.md
CHANGED
@@ -10,12 +10,6 @@ A reliable Chef API client with a clean syntax
|
|
10
10
|
|
11
11
|
$ gem install ridley
|
12
12
|
|
13
|
-
## Known Issues
|
14
|
-
|
15
|
-
* Sandboxes has not been implemented
|
16
|
-
* Full support for Cookbooks is not included
|
17
|
-
* Acceptance test suite needs to be refactored
|
18
|
-
|
19
13
|
## Usage
|
20
14
|
|
21
15
|
Require Ridley into your application
|
@@ -24,42 +18,25 @@ Require Ridley into your application
|
|
24
18
|
|
25
19
|
## Creating a new Ridley client
|
26
20
|
|
27
|
-
|
28
|
-
server_url: "https://api.opscode.com",
|
21
|
+
ridley = Ridley.new(
|
22
|
+
server_url: "https://api.opscode.com/organizations/ridley",
|
29
23
|
client_name: "reset",
|
30
|
-
client_key: "/Users/reset/.chef/reset.pem"
|
31
|
-
organization: "ridley"
|
24
|
+
client_key: "/Users/reset/.chef/reset.pem"
|
32
25
|
)
|
33
26
|
|
34
|
-
Creating a new
|
27
|
+
Creating a new instance of Ridley requires the following options:
|
35
28
|
|
36
29
|
* server_url
|
37
30
|
* client_name
|
38
31
|
* client_key
|
39
32
|
|
40
|
-
|
41
|
-
|
42
|
-
Connections can also be instantiated by a helper function: `Ridley.new`
|
43
|
-
|
44
|
-
Ridley.new(
|
45
|
-
server_url: "https://api.opscode.com",
|
46
|
-
client_name: "reset",
|
47
|
-
client_key: "/Users/reset/.chef/reset.pem"
|
48
|
-
)
|
49
|
-
|
50
|
-
Using a connection object you can interact with collections of resources on a Chef server. Resources are:
|
51
|
-
|
52
|
-
* Nodes
|
53
|
-
* Roles
|
54
|
-
* Environments
|
55
|
-
* Clients
|
56
|
-
* Cookbooks
|
57
|
-
* Data Bags
|
33
|
+
Ridley exposes a number of functions that return resources which you can use to retrieve or create objects on your Chef server. Here is a simple example of getting a list of all the roles on your Chef server.
|
58
34
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
35
|
+
ridley = Ridley.new(...)
|
36
|
+
ridley.role.all #=> [
|
37
|
+
#<Ridley::RoleObject chef_id:motherbrain_srv ...>,
|
38
|
+
#<Ridley::RoleObject chef_id:motherbrain_proxy ...>
|
39
|
+
]
|
63
40
|
|
64
41
|
For more information scroll down to the Manipulating Chef Resources section of this README.
|
65
42
|
|
@@ -67,9 +44,8 @@ For more information scroll down to the Manipulating Chef Resources section of t
|
|
67
44
|
|
68
45
|
An alternative syntax is provided if you want to perform multiple requests, in order, on a connection.
|
69
46
|
|
70
|
-
|
71
|
-
|
72
|
-
conn.sync do
|
47
|
+
ridley = Ridley.new(...)
|
48
|
+
ridley.sync do
|
73
49
|
role.all
|
74
50
|
role.find("reset")
|
75
51
|
role.create(name: "ridley-test")
|
@@ -78,170 +54,157 @@ An alternative syntax is provided if you want to perform multiple requests, in o
|
|
78
54
|
|
79
55
|
The `sync` function on the connection object takes a block with no arguments and allows you to access the DSL within the block. You can address any one of the resources within the sync block:
|
80
56
|
|
81
|
-
|
57
|
+
ridley.sync do
|
82
58
|
environment.all
|
83
59
|
node.all
|
84
60
|
...
|
85
61
|
end
|
86
62
|
|
87
|
-
|
63
|
+
For one-liner requests you can create a new instance of Ridley and dispose of it with `Ridley.open`
|
88
64
|
|
89
|
-
Ridley.
|
90
|
-
role.all
|
65
|
+
Ridley.open(server_url: "https://api.opscode.com", ...) do
|
66
|
+
role.all
|
91
67
|
end
|
92
68
|
|
93
|
-
### Asynchronous execution
|
94
|
-
|
95
|
-
__COMING SOON__
|
96
|
-
|
97
69
|
## Manipulating Chef Resources
|
98
70
|
|
99
|
-
|
100
|
-
|
101
|
-
### Listing all resources
|
71
|
+
Resources are access by instance functions on a new instance of Ridley::Client.
|
102
72
|
|
103
|
-
|
73
|
+
ridley = Ridley.new(...)
|
74
|
+
ridley.client #=> Ridley::ClientResource
|
75
|
+
ridley.cookbook #=> Ridley::CookbookResource
|
76
|
+
ridley.data_bag #=> Ridley::DataBagResource
|
77
|
+
ridley.environment #=> Ridley::EnvironmentResource
|
78
|
+
ridley.node #=> Ridley::NodeResource
|
79
|
+
ridley.role #=> Ridley::RoleResource
|
80
|
+
ridley.sandbox #=> Ridley::SandboxResource
|
81
|
+
ridley.search #=> Ridley::SearchResource
|
104
82
|
|
105
|
-
|
106
|
-
conn.role.all => []
|
83
|
+
DataBagItems are the only exception to this rule. The DataBagItem resource is accessed from a DataBagObject
|
107
84
|
|
108
|
-
|
85
|
+
data_bag = ridley.data_bag.find("my_data")
|
86
|
+
data_bag.item #=> Ridley::DataBagItemResource
|
87
|
+
data_bag.item.find("my_item") #=> Ridley::DataBagItemObject
|
109
88
|
|
110
|
-
|
111
|
-
conn.node.all => [<#Ridley::NodeResource>]
|
112
|
-
conn.role.all => [<#Ridley::RoleResource>]
|
113
|
-
conn.environment.all => [<#Ridley::EnvironmentResource>]
|
114
|
-
conn.client.all => [<#Ridley::ClientResource>]
|
115
|
-
conn.cookbook.all => [<#Ridley::CookbookResource>]
|
116
|
-
conn.data_bag.all => [<#Ridley::DataBagResource>]
|
89
|
+
### CRUD
|
117
90
|
|
118
|
-
|
91
|
+
Most resources can be listed, retrieved, created, updated, and destroyed. These are commonly referred to as CRUD (Create Read Update Delete) operations.
|
119
92
|
|
120
|
-
|
93
|
+
#### Create
|
121
94
|
|
122
|
-
|
95
|
+
A new Chef Object can be created in a three ways
|
123
96
|
|
124
|
-
|
125
|
-
obj = conn.role.new
|
126
|
-
|
127
|
-
obj.name = "reset"
|
128
|
-
obj.save => <#Ridley::RoleResource: @name="reset">
|
97
|
+
_With the `#create` function and an attribute hash_
|
129
98
|
|
130
|
-
|
99
|
+
ridley = Ridley.new(...)
|
100
|
+
ridley.role.create(name: "reset") #=> #<Ridley::RoleObject: chef_id:reset>
|
131
101
|
|
132
|
-
|
133
|
-
conn.role.create(name: "reset") => <#Ridley::RoleResource: @name="reset">
|
102
|
+
_With the `#create` function and an instance of a Chef Object_
|
134
103
|
|
135
|
-
|
104
|
+
obj = ridley.role.new
|
105
|
+
obj.name = "reset"
|
106
|
+
ridley.role.create(obj) #=> #<Ridley::RoleObject: chef_id:reset>
|
136
107
|
|
137
|
-
|
138
|
-
obj = conn.role.new
|
108
|
+
_With the `#save` function on an instance of a Chef Object_
|
139
109
|
|
110
|
+
obj = ridley.role.new
|
140
111
|
obj.name = "reset"
|
141
|
-
|
112
|
+
obj.save #=> #<Ridley::RoleObject: chef_id:reset>
|
142
113
|
|
143
|
-
Each of these methods
|
114
|
+
Each of these methods produce an identical object on the Chef server. It is up to you on how you'd like to create new resources.
|
144
115
|
|
145
|
-
###
|
116
|
+
### Read
|
146
117
|
|
147
|
-
|
118
|
+
Most resources have two read functions
|
148
119
|
|
149
|
-
|
120
|
+
- `#all` for listing all the Chef Objects
|
121
|
+
- `#find` for retrieving a specific Chef Object
|
150
122
|
|
151
|
-
|
123
|
+
#### Listing
|
152
124
|
|
153
|
-
|
125
|
+
If you wanted to get a list of all of the roles on your Chef server
|
154
126
|
|
155
|
-
|
156
|
-
|
127
|
+
ridley = Ridley.new(...)
|
128
|
+
ridley.role.all #=> [
|
129
|
+
#<Ridley::RoleObject chef_id:motherbrain_srv ...>,
|
130
|
+
#<Ridley::RoleObject chef_id:motherbrain_proxy ...>
|
131
|
+
]
|
157
132
|
|
158
|
-
Now if we attempt to find a role that does not exist on the Chef server
|
159
133
|
|
160
|
-
|
134
|
+
#### Finding
|
161
135
|
|
162
|
-
|
163
|
-
conn.role.find!("not_there") =>
|
164
|
-
Ridley::Errors::HTTPNotFound: errors: 'Cannot load role reset'
|
165
|
-
from /Users/reset/code/ridley/lib/ridley/middleware/chef_response.rb:11:in `on_complete'
|
166
|
-
from /Users/reset/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/faraday-0.8.1/lib/faraday/response.rb:9:in `block in call'
|
167
|
-
from /Users/reset/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/faraday-0.8.1/lib/faraday/response.rb:63:in `on_complete'
|
168
|
-
from /Users/reset/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/faraday-0.8.1/lib/faraday/response.rb:8:in `call'
|
169
|
-
from /Users/reset/code/ridley/lib/ridley/middleware/chef_auth.rb:31:in `call'
|
170
|
-
from /Users/reset/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/faraday-0.8.1/lib/faraday/connection.rb:226:in `run_request'
|
171
|
-
from /Users/reset/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/faraday-0.8.1/lib/faraday/connection.rb:87:in `get'
|
172
|
-
from /Users/reset/code/ridley/lib/ridley/resource.rb:115:in `find!'
|
173
|
-
from /Users/reset/code/ridley/lib/ridley/context.rb:22:in `method_missing'
|
174
|
-
from (irb):6
|
175
|
-
from /Users/reset/.rbenv/versions/1.9.3-p194/bin/irb:12:in `<main>'
|
136
|
+
If you want to retrieve a single role from the Chef server
|
176
137
|
|
177
|
-
|
138
|
+
ridley = Ridley.new(...)
|
139
|
+
ridley.role.find("motherbrain_srv") #=> #<Ridley::RoleObject: chef_id:motherbrain_srv ...>
|
178
140
|
|
179
|
-
|
141
|
+
If the role does not exist on the Chef server then `nil` is returned
|
180
142
|
|
181
|
-
|
143
|
+
ridley = Ridley.new(...)
|
144
|
+
ridley.role.find("not_there") #=> nil
|
182
145
|
|
183
|
-
|
184
|
-
conn.role.update("reset", description: "testing updates!") => <#Ridley::RoleResource: @name="reset", @description="testing updates!">
|
146
|
+
### Update
|
185
147
|
|
186
|
-
|
148
|
+
Updating a resource can be expressed in three ways
|
187
149
|
|
188
|
-
|
189
|
-
obj = conn.role.find("reset")
|
190
|
-
obj.description = "resource object!"
|
150
|
+
_With the `#update` function, the ID of the Object to update, and an attributes hash_
|
191
151
|
|
192
|
-
|
152
|
+
ridley = Ridley.new(...)
|
153
|
+
ridley.role.update("motherbrain_srv", description: "testing updates") #=>
|
154
|
+
#<Ridley::RoleObject chef_id:motherbrain_srv, description="testing updates" ...>
|
193
155
|
|
194
|
-
|
156
|
+
_With the `#update` function and an instance of a Chef Object_
|
195
157
|
|
196
|
-
|
197
|
-
obj =
|
158
|
+
obj = ridley.role.find("motherbrain_srv")
|
159
|
+
obj.description = "chef object"
|
198
160
|
|
199
|
-
obj
|
200
|
-
obj.save => <#Ridley::RoleResource: @name="reset", @description="saving an object!">
|
161
|
+
ridley.role.update(obj) #=> #<Ridley::RoleObject: chef_id:motherbrain_srv, description="chef object" ...
|
201
162
|
|
202
|
-
|
163
|
+
_With the `#save` function on an instance of a Chef Object_
|
203
164
|
|
204
|
-
|
165
|
+
obj = ridley.role.find("reset")
|
166
|
+
obj.description = "saving an object"
|
167
|
+
obj.save #=> #<Ridley::RoleObject: chef_id:motherbrain_srv, description="saving an object" ...>
|
205
168
|
|
206
|
-
|
169
|
+
### Destroy
|
207
170
|
|
208
|
-
|
209
|
-
conn.role.delete("reset") => <#Ridley::RoleResource: @name="reset">
|
171
|
+
Destroying a resource can be express in three ways
|
210
172
|
|
211
|
-
|
173
|
+
_With the `#delete` function and the ID of the Object to destroy_
|
212
174
|
|
213
|
-
|
214
|
-
|
175
|
+
ridley = Ridley.new(...)
|
176
|
+
ridley.role.delete("motherbrain_srv") => #<Ridley::RoleObject: chef_id:motherbrain_srv ...>
|
215
177
|
|
216
|
-
|
178
|
+
_With the `#delete` function and a Chef Object_
|
217
179
|
|
218
|
-
|
180
|
+
obj = ridley.role.find("motherbrain_srv")
|
181
|
+
ridley.role.delete(obj) => #<Ridley::RoleObject: chef_id:motherbrain_srv ...>
|
219
182
|
|
220
|
-
|
221
|
-
obj = conn.role.find("reset")
|
183
|
+
_With the `#destroy` function on an instance of a Chef Object_
|
222
184
|
|
223
|
-
obj
|
185
|
+
obj = conn.role.find("motherbrain_srv")
|
186
|
+
obj.destroy #=> true
|
224
187
|
|
188
|
+
## Client Resource
|
225
189
|
### Regenerating a client's private key
|
226
190
|
|
227
|
-
|
228
|
-
|
229
|
-
conn = Ridley.new(...)
|
230
|
-
conn.client.regenerate_key("jwinsor") => <#Ridley::ClientResource: @name="jwinsor", @private_key="HIDDEN">
|
191
|
+
_With the `#regnerate_key` function and the ID of the Client to regenerate_
|
231
192
|
|
232
|
-
|
193
|
+
ridley = Ridley.new(...)
|
194
|
+
ridley.client.regenerate_key("jamie") #=> #<Ridley::ClientObject: chef_id:"jamie", private_key="**HIDDEN***" ...>
|
233
195
|
|
234
|
-
|
235
|
-
obj = conn.client.find("jwinsor")
|
196
|
+
_With the `#regenerate_key` function on an instance of a Client Object_
|
236
197
|
|
237
|
-
obj
|
198
|
+
obj = ridley.client.find("jamie")
|
199
|
+
obj.regenerate_key #=> #<Ridley::ClientObject: chef_id:"jamie", private_key="**HIDDEN***" ...>
|
238
200
|
|
239
|
-
##
|
201
|
+
## Cookbook Resource
|
202
|
+
## Data Bag Resource
|
240
203
|
|
241
204
|
A data bag is managed exactly the same as any other Chef resource
|
242
205
|
|
243
|
-
|
244
|
-
|
206
|
+
ridley = Ridley.new(...)
|
207
|
+
ridley.data_bag.create("ridley-test")
|
245
208
|
|
246
209
|
You can create, delete, update, or retrieve a data bag exactly how you would expect if you read through the
|
247
210
|
Manipulating Chef Resources portion of this document.
|
@@ -250,92 +213,31 @@ Unlike a role, node, client, or environment, a data bag is a container for other
|
|
250
213
|
|
251
214
|
### Creating a Data Bag Item
|
252
215
|
|
253
|
-
|
254
|
-
data_bag =
|
255
|
-
|
256
|
-
data_bag.item.create(id: "appconfig", host: "reset.local", user: "jwinsor") =>
|
257
|
-
<#Ridley::DataBagItemResource: @id="appconfig", @host="reset.local", @user="jwinsor">
|
258
|
-
|
259
|
-
### Saving a Data Bag Item
|
260
|
-
|
261
|
-
conn = Ridley.new(...)
|
262
|
-
data_bag = conn.data_bag.create("ridley-test")
|
263
|
-
|
264
|
-
dbi = data_bag.item.new
|
265
|
-
dbi[:id] = "appconfig"
|
266
|
-
dbi[:host] = "reset.local"
|
267
|
-
dbi.save => true
|
268
|
-
|
269
|
-
## Searching
|
270
|
-
|
271
|
-
conn = Ridley.new(...)
|
272
|
-
conn.search(:node)
|
273
|
-
conn.search(:node, "name:ridley-test.local")
|
274
|
-
|
275
|
-
Search will return an array of Ridley resource objects if one of the default indices is specified. Chef's default indices are
|
276
|
-
|
277
|
-
* node
|
278
|
-
* role
|
279
|
-
* client
|
280
|
-
* environment
|
281
|
-
|
282
|
-
## Manipulating Attributes
|
283
|
-
|
284
|
-
Using Ridley you can quickly manipulate node or environment attributes. Attributes are identified by a dotted path notation.
|
285
|
-
|
286
|
-
default[:my_app][:billing][:enabled] => "my_app.billing.enabled"
|
287
|
-
|
288
|
-
Given the previous example you could set the default node attribute with the `set_default_attribute` function on a Node object
|
289
|
-
|
290
|
-
### Node Attributes
|
291
|
-
|
292
|
-
Setting the `node[:my_app][:billing][:enabled]` node level attribute on the node "jwinsor-1"
|
216
|
+
ridley = Ridley.new(...)
|
217
|
+
data_bag = ridley.data_bag.create("ridley-test")
|
293
218
|
|
294
|
-
|
295
|
-
|
296
|
-
obj = node.find("jwinsor-1")
|
297
|
-
obj.set_attribute("my_app.billing.enabled", false)
|
298
|
-
obj.save
|
299
|
-
end
|
219
|
+
data_bag.item.create(id: "appconfig", host: "reset.local", user: "jamie") #=>
|
220
|
+
#<Ridley::DataBagItemObject: chef_id:appconfig, host="reset.local", user="jamie">
|
300
221
|
|
301
|
-
|
222
|
+
## Environment Resource
|
223
|
+
## Node Resource
|
224
|
+
### Setting Attributes
|
302
225
|
|
303
226
|
Setting a default environment attribute is just like setting a node level default attribute
|
304
227
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
obj.save
|
310
|
-
end
|
228
|
+
ridley = Ridley.new(...)
|
229
|
+
production_env = ridley.environment.find("production")
|
230
|
+
production_env.set_default_attribute("my_app.proxy.enabled", false)
|
231
|
+
production_env.save #=> true
|
311
232
|
|
312
233
|
And the same goes for setting an environment level override attribute
|
313
234
|
|
314
|
-
|
315
|
-
|
316
|
-
obj = environment.find("production")
|
317
|
-
obj.set_override_attribute("my_app.webapp.enabled", false)
|
318
|
-
obj.save
|
319
|
-
end
|
320
|
-
|
321
|
-
### Role Attributes
|
322
|
-
|
323
|
-
conn = Ridley.new
|
324
|
-
conn.sync do
|
325
|
-
obj = role.find("why_god_why")
|
326
|
-
obj.set_default_attribute("my_app.proxy.enabled", false)
|
327
|
-
obj.save
|
328
|
-
end
|
329
|
-
|
330
|
-
conn.sync do
|
331
|
-
obj = role.find("why_god_why")
|
332
|
-
obj.set_override_attribute("my_app.webapp.enabled", false)
|
333
|
-
obj.save
|
334
|
-
end
|
235
|
+
production_env.set_override_attribute("my_app.proxy.enabled", false)
|
236
|
+
production_env.save #=> true
|
335
237
|
|
336
|
-
|
238
|
+
### Bootstrapping Unix nodes
|
337
239
|
|
338
|
-
|
240
|
+
ridley = Ridley.new(
|
339
241
|
server_url: "https://api.opscode.com",
|
340
242
|
organization: "vialstudios",
|
341
243
|
validator_client: "vialstudios-validator",
|
@@ -346,13 +248,13 @@ And the same goes for setting an environment level override attribute
|
|
346
248
|
}
|
347
249
|
)
|
348
250
|
|
349
|
-
|
251
|
+
ridley.node.bootstrap("33.33.33.10", "33.33.33.11")
|
350
252
|
|
351
|
-
|
253
|
+
### Bootstrapping Windows Nodes
|
352
254
|
|
353
255
|
Windows Nodes are bootstrapped using a combination of WinRM, Batch, and PowerShell. You will probably need to tweak some settings on your Windows servers to ensure the commands are successful.
|
354
256
|
|
355
|
-
|
257
|
+
#### WinRM Settings
|
356
258
|
|
357
259
|
1. Enable WinRM: `winrm quickconfig` and say Yes.
|
358
260
|
2. Set some WinRM settings to ensure that you don't get 401 Unauthorized responses and 500 Responses because of timeouts.
|
@@ -365,7 +267,7 @@ winrm set winrm/config @{MaxTimeoutms="600000"}
|
|
365
267
|
winrm set winrm/config/client @{TrustedHosts="*"}
|
366
268
|
```
|
367
269
|
|
368
|
-
|
270
|
+
#### PowerShell Settings
|
369
271
|
|
370
272
|
1. You should also configure your PowerShell profile, so that PowerShell commands have a more lenient timeout period.
|
371
273
|
|
@@ -383,6 +285,35 @@ The following links offer some information about configuring a machine's PowerSh
|
|
383
285
|
|
384
286
|
You may also want to tweak your Windows boxes a bit more ex: turning UAC off, turning off the Windows Firewall.
|
385
287
|
|
288
|
+
## Role Resource
|
289
|
+
### Role Attributes
|
290
|
+
|
291
|
+
Setting role attributes is just like setting node and environment attributes
|
292
|
+
|
293
|
+
ridley = Ridley.new(...)
|
294
|
+
my_app_role = ridley.role.find("my_app")
|
295
|
+
my_app_role.set_default_attribute("my_app.proxy.enabled", false)
|
296
|
+
my_app_role.save #=> true
|
297
|
+
|
298
|
+
And the same goes for setting an environment level override attribute
|
299
|
+
|
300
|
+
my_app_role.set_override_attribute("my_app.proxy.enabled", false)
|
301
|
+
my_app_role.save #=> true
|
302
|
+
|
303
|
+
## Sandbox Resource
|
304
|
+
## Search Resource
|
305
|
+
|
306
|
+
ridley = Ridley.new(...)
|
307
|
+
ridley.search(:node)
|
308
|
+
ridley.search(:node, "name:ridley-test.local")
|
309
|
+
|
310
|
+
Search will return an array of the appropriate Chef Objects if one of the default indices is specified. The indices are
|
311
|
+
|
312
|
+
* node
|
313
|
+
* role
|
314
|
+
* client
|
315
|
+
* environment
|
316
|
+
|
386
317
|
# Authors and Contributors
|
387
318
|
|
388
319
|
* Jamie Winsor (<reset@riotgames.com>)
|