from-scratch 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Berksfile.lock +11 -0
- data/chefignore +1 -0
- data/cookbooks/apt/CHANGELOG.md +248 -0
- data/cookbooks/apt/README.md +294 -0
- data/cookbooks/apt/attributes/default.rb +51 -0
- data/cookbooks/apt/files/default/15update-stamp +1 -0
- data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/libraries/helpers.rb +61 -0
- data/cookbooks/apt/libraries/matchers.rb +17 -0
- data/cookbooks/apt/libraries/network.rb +31 -0
- data/cookbooks/apt/metadata.json +1 -0
- data/cookbooks/apt/providers/preference.rb +84 -0
- data/cookbooks/apt/providers/repository.rb +246 -0
- data/cookbooks/apt/recipes/cacher-client.rb +83 -0
- data/cookbooks/apt/recipes/cacher-ng.rb +43 -0
- data/cookbooks/apt/recipes/default.rb +112 -0
- data/cookbooks/apt/recipes/unattended-upgrades.rb +47 -0
- data/cookbooks/apt/resources/preference.rb +37 -0
- data/cookbooks/apt/resources/repository.rb +60 -0
- data/cookbooks/apt/templates/debian-6.0/acng.conf.erb +173 -0
- data/cookbooks/apt/templates/default/01proxy.erb +9 -0
- data/cookbooks/apt/templates/default/10recommends.erb +3 -0
- data/cookbooks/apt/templates/default/20auto-upgrades.erb +2 -0
- data/cookbooks/apt/templates/default/50unattended-upgrades.erb +68 -0
- data/cookbooks/apt/templates/default/acng.conf.erb +275 -0
- data/cookbooks/apt/templates/default/unattended-upgrades.seed.erb +1 -0
- data/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +269 -0
- data/cookbooks/build-essential/CHANGELOG.md +136 -0
- data/cookbooks/build-essential/README.md +108 -0
- data/cookbooks/build-essential/attributes/default.rb +20 -0
- data/cookbooks/build-essential/libraries/matchers.rb +5 -0
- data/cookbooks/build-essential/libraries/timing.rb +124 -0
- data/cookbooks/build-essential/libraries/xcode_command_line_tools.rb +210 -0
- data/cookbooks/build-essential/metadata.json +1 -0
- data/cookbooks/build-essential/recipes/_debian.rb +28 -0
- data/cookbooks/build-essential/recipes/_fedora.rb +32 -0
- data/cookbooks/build-essential/recipes/_freebsd.rb +24 -0
- data/cookbooks/build-essential/recipes/_mac_os_x.rb +22 -0
- data/cookbooks/build-essential/recipes/_omnios.rb +33 -0
- data/cookbooks/build-essential/recipes/_rhel.rb +36 -0
- data/cookbooks/build-essential/recipes/_smartos.rb +27 -0
- data/cookbooks/build-essential/recipes/_solaris2.rb +48 -0
- data/cookbooks/build-essential/recipes/_suse.rb +29 -0
- data/cookbooks/build-essential/recipes/default.rb +29 -0
- data/cookbooks/chef-sugar/CHANGELOG.md +159 -0
- data/cookbooks/chef-sugar/README.md +464 -0
- data/cookbooks/chef-sugar/metadata.json +1 -0
- data/cookbooks/chef-sugar/recipes/default.rb +34 -0
- data/cookbooks/openssl/CHANGELOG.md +30 -0
- data/cookbooks/openssl/README.md +115 -0
- data/cookbooks/openssl/attributes/default.rb +21 -0
- data/cookbooks/openssl/libraries/secure_password.rb +37 -0
- data/cookbooks/openssl/metadata.json +31 -0
- data/cookbooks/openssl/providers/x509.rb +94 -0
- data/cookbooks/openssl/recipes/default.rb +18 -0
- data/cookbooks/openssl/recipes/upgrade.rb +39 -0
- data/cookbooks/openssl/resources/x509.rb +16 -0
- data/cookbooks/postgresql/CHANGELOG.md +220 -0
- data/cookbooks/postgresql/README.md +464 -0
- data/cookbooks/postgresql/attributes/default.rb +549 -0
- data/cookbooks/postgresql/files/default/tests/minitest/apt_pgdg_postgresql_test.rb +39 -0
- data/cookbooks/postgresql/files/default/tests/minitest/default_test.rb +27 -0
- data/cookbooks/postgresql/files/default/tests/minitest/ruby_test.rb +28 -0
- data/cookbooks/postgresql/files/default/tests/minitest/server_test.rb +43 -0
- data/cookbooks/postgresql/files/default/tests/minitest/support/helpers.rb +29 -0
- data/cookbooks/postgresql/libraries/default.rb +377 -0
- data/cookbooks/postgresql/metadata.json +56 -0
- data/cookbooks/postgresql/recipes/apt_pgdg_postgresql.rb +18 -0
- data/cookbooks/postgresql/recipes/client.rb +32 -0
- data/cookbooks/postgresql/recipes/config_initdb.rb +148 -0
- data/cookbooks/postgresql/recipes/config_pgtune.rb +284 -0
- data/cookbooks/postgresql/recipes/contrib.rb +44 -0
- data/cookbooks/postgresql/recipes/default.rb +18 -0
- data/cookbooks/postgresql/recipes/ruby.rb +117 -0
- data/cookbooks/postgresql/recipes/server.rb +89 -0
- data/cookbooks/postgresql/recipes/server_conf.rb +34 -0
- data/cookbooks/postgresql/recipes/server_debian.rb +38 -0
- data/cookbooks/postgresql/recipes/server_redhat.rb +100 -0
- data/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb +45 -0
- data/cookbooks/postgresql/templates/default/pg_hba.conf.erb +35 -0
- data/cookbooks/postgresql/templates/default/pgsql.sysconfig.erb +4 -0
- data/cookbooks/postgresql/templates/default/postgresql.conf.erb +21 -0
- data/cookbooks/scratchify/.chef/knife.rb +2 -5
- data/cookbooks/scratchify/Berksfile +2 -1
- data/cookbooks/scratchify/Berksfile.lock +11 -0
- data/cookbooks/scratchify/README.md +34 -17
- data/cookbooks/scratchify/bin/scratchify +1 -1
- data/cookbooks/scratchify/chefignore +1 -0
- data/cookbooks/scratchify/from-scratch.gemspec +2 -5
- data/cookbooks/scratchify/lib/from-scratch.rb +25 -0
- data/cookbooks/scratchify/lib/{from/scratch → from-scratch}/version.rb +1 -1
- data/cookbooks/scratchify/metadata.json +2 -1
- data/cookbooks/scratchify/templates/node.json.erb +34 -0
- data/cookbooks/scratchify/templates/user.json.erb +6 -0
- data/lib/from-scratch.rb +2 -2
- data/lib/from-scratch/version.rb +1 -1
- data/templates/node.json.erb +6 -3
- metadata +85 -10
- data/cookbooks/scratchify/bin/console +0 -14
- data/cookbooks/scratchify/bin/setup +0 -7
- data/cookbooks/scratchify/data_bags/users/deploy.json +0 -6
- data/cookbooks/scratchify/environments/.gitkeep +0 -0
- data/cookbooks/scratchify/lib/from/scratch.rb +0 -31
- data/cookbooks/scratchify/lib/from/scratch/interviewer.rb +0 -35
- data/cookbooks/scratchify/nodes/normfood.ru.json +0 -75
- data/cookbooks/scratchify/roles/.gitkeep +0 -0
@@ -0,0 +1,464 @@
|
|
1
|
+
Chef Sugar
|
2
|
+
==========
|
3
|
+
[![Gem Version](http://img.shields.io/gem/v/chef-sugar.svg?style=flat-square)][gem]
|
4
|
+
[![Build Status](http://img.shields.io/travis/sethvargo/chef-sugar.svg?style=flat-square)][travis]
|
5
|
+
|
6
|
+
[gem]: https://rubygems.org/gems/chef-sugar
|
7
|
+
[travis]: http://travis-ci.org/sethvargo/chef-sugar
|
8
|
+
|
9
|
+
Chef Sugar is a Gem & Chef Recipe that includes series of helpful sugar of the Chef core and other resources to make a cleaner, more lean recipe DSL, enforce DRY principles, and make writing Chef recipes an awesome experience!
|
10
|
+
|
11
|
+
|
12
|
+
Installation
|
13
|
+
------------
|
14
|
+
If you want to develop/hack on chef-sugar, please see the Contributing.md.
|
15
|
+
|
16
|
+
If you are using Berkshelf, add `chef-sugar` to your `Berksfile`:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
cookbook 'chef-sugar'
|
20
|
+
```
|
21
|
+
|
22
|
+
Otherwise, you can use `knife` or download the tarball directly from the community site:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
knife cookbook site install chef-sugar
|
26
|
+
```
|
27
|
+
|
28
|
+
|
29
|
+
Usage
|
30
|
+
-----
|
31
|
+
In order to use Chef Sugar in your Chef Recipes, you'll first need to include it:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
include_recipe 'chef-sugar::default'
|
35
|
+
```
|
36
|
+
|
37
|
+
Alternatively you can put it in a base role or recipe and it will be included subsequently.
|
38
|
+
|
39
|
+
Requiring the Chef Sugar Gem will automatically extend the Recipe DSL, `Chef::Resource`, and `Chef::Provider` with helpful convenience methods.
|
40
|
+
|
41
|
+
### Module Method
|
42
|
+
If you are working outside of the Recipe DSL, you can use the module methods instead of the Recipe DSL. In general, the module methods have the same name as their Recipe-DSL counterparts, but require the node object as a parameter. For example:
|
43
|
+
|
44
|
+
In a Recipe:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# cookbook/recipes/default.rb
|
48
|
+
do_something if windows?
|
49
|
+
```
|
50
|
+
|
51
|
+
In a Library as a singleton:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
# cookbook/libraries/default.rb
|
55
|
+
def only_on_windows(&block)
|
56
|
+
yield if Chef::Sugar::PlatformFamily.windows?(@node)
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
In a Library as a Mixin:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
# cookbook/libraries/default.rb
|
64
|
+
include Chef::Sugar::PlatformFamily
|
65
|
+
|
66
|
+
def only_on_windows(&block)
|
67
|
+
yield if windows?(@node)
|
68
|
+
end
|
69
|
+
```
|
70
|
+
|
71
|
+
|
72
|
+
API
|
73
|
+
---
|
74
|
+
**Note:** For the most extensive API documentation, please see the YARD documentation.
|
75
|
+
|
76
|
+
### Architecture
|
77
|
+
**Note:** Some of the architecture commands begin with an underscore (`_`) because Ruby does not permit methods to start with a numeric.
|
78
|
+
|
79
|
+
- `_64_bit?`
|
80
|
+
- `_32_bit?`
|
81
|
+
- `intel?`
|
82
|
+
- `sparc?`
|
83
|
+
- `ppc64?`
|
84
|
+
- `ppc64le?`
|
85
|
+
|
86
|
+
#### Examples
|
87
|
+
```ruby
|
88
|
+
execute 'build[my binary]' do
|
89
|
+
command '...'
|
90
|
+
not_if { _64_bit? }
|
91
|
+
end
|
92
|
+
```
|
93
|
+
|
94
|
+
### Cloud
|
95
|
+
- `azure?`
|
96
|
+
- `cloud?`
|
97
|
+
- `digitalocean?`
|
98
|
+
- `ec2?`
|
99
|
+
- `eucalyptus?`
|
100
|
+
- `gce?`
|
101
|
+
- `linode?`
|
102
|
+
- `openstack?`
|
103
|
+
- `cloudstack?`
|
104
|
+
- `rackspace?`
|
105
|
+
|
106
|
+
#### Examples
|
107
|
+
```ruby
|
108
|
+
template '/tmp/config' do
|
109
|
+
variables(
|
110
|
+
# See also: best_ip_for
|
111
|
+
ipaddress: cloud? ? node['local_ipv4'] : node['public_ipv4']
|
112
|
+
)
|
113
|
+
end
|
114
|
+
```
|
115
|
+
|
116
|
+
### Core Extensions
|
117
|
+
**Note:** Core extensions are **not** included by default. You must require the `chef/sugar/core_extensions` module manually to gain access to these APIs:
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
require 'chef/sugar/core_extensions'
|
121
|
+
```
|
122
|
+
|
123
|
+
- `String#satisfies?`
|
124
|
+
- `String#satisfied_by?`
|
125
|
+
- `Array#satisfied_by?`
|
126
|
+
- `Object#blank?`
|
127
|
+
|
128
|
+
#### Examples
|
129
|
+
```ruby
|
130
|
+
# Checking version constraints
|
131
|
+
'1.0.0'.satisfies?('~> 1.0') #=> true
|
132
|
+
'~> 1.0'.satisfied_by?('1.0') #=> true
|
133
|
+
```
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
# Check for an object's presence
|
137
|
+
''.blank? #=> true
|
138
|
+
['hello'].blank? #=> false
|
139
|
+
```
|
140
|
+
|
141
|
+
### Data Bag
|
142
|
+
- `encrypted_data_bag_item` - a handy DSL method for loading encrypted data bag items the same way you load a regular data bag item; this requires `Chef::Config[:encrypted_data_bag_secret]` is set!
|
143
|
+
- `encrypted_data_bag_item_for_environment` - find the encrypted data bag entry for the current node's Chef environment.
|
144
|
+
- `data_bag_item_for_environment` - find the data bag entry for the current node's Chef environment.
|
145
|
+
|
146
|
+
#### Examples
|
147
|
+
```ruby
|
148
|
+
encrypted_data_bag_item('accounts', 'hipchat')
|
149
|
+
```
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
encrypted_data_bag_item_for_environment('accounts', 'github')
|
153
|
+
```
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
data_bag_item_for_environment('accounts', 'github')
|
157
|
+
```
|
158
|
+
|
159
|
+
### Docker
|
160
|
+
Chef Sugar looks for hints to see if the node being converged is a Docker container. When [Ohai supports checking other nodes](https://github.com/opscode/ohai/pull/428), Chef Sugar will automatically pick up the information.
|
161
|
+
|
162
|
+
- `docker?`
|
163
|
+
|
164
|
+
#### Examples
|
165
|
+
```ruby
|
166
|
+
template '/runme' do
|
167
|
+
only_if { docker?(node) }
|
168
|
+
end
|
169
|
+
```
|
170
|
+
|
171
|
+
### Attributes
|
172
|
+
Chef Sugar adds more Chef-like DSL to attribute definitions. Instead of using the Ruby hash syntax, you can define attributes using nested namespaces. This DSL may be more friendly to non-Ruby developers. It can safely be mixed-and-matched with the standard syntax.
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
# This is functionally the same as default['apache2']['config']['root'] = '/var/www'
|
176
|
+
namespace 'apache2' do
|
177
|
+
namespace 'config' do
|
178
|
+
root '/var/www'
|
179
|
+
end
|
180
|
+
end
|
181
|
+
```
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
# Specify multiple keys instead of nesting namespaces
|
185
|
+
namespace 'apache2', 'config' do
|
186
|
+
root '/var/www'
|
187
|
+
end
|
188
|
+
```
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
# Specify different nested precedence levels
|
192
|
+
namespace 'apache2', precedence: normal do
|
193
|
+
namespace 'config', precedence: override do
|
194
|
+
root '/var/www' #=> override['apache2']['config']['root'] = '/var/www'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
```
|
198
|
+
|
199
|
+
### Constraints
|
200
|
+
- `constraints` - create a new constraint (or requirement) that can be used to test version validations.
|
201
|
+
- `chef_version` - (DSL only) a wrapper for `version(Chef::VERSION)`
|
202
|
+
- `version` - create a new version that can be used to test constraint validation.
|
203
|
+
|
204
|
+
#### Examples
|
205
|
+
```ruby
|
206
|
+
# Check if a version is satisfied by a constraint
|
207
|
+
version('1.2.3').satisfies?('~> 1.2.0')
|
208
|
+
```
|
209
|
+
|
210
|
+
```ruby
|
211
|
+
# Check if a constraint is satisfied by a version
|
212
|
+
constraint('~> 1.2.0').satisfied_by?('1.2.3')
|
213
|
+
```
|
214
|
+
|
215
|
+
```ruby
|
216
|
+
# Support multiple constraints
|
217
|
+
version('1.2.3').satisfies?('> 1.2', '< 2.0')
|
218
|
+
constraint('> 1.2', '< 2.0').satisfied_by?('1.2.3')
|
219
|
+
```
|
220
|
+
|
221
|
+
```ruby
|
222
|
+
# Only perform an operation if Chef is at a certain version
|
223
|
+
package 'apache2' do
|
224
|
+
not_if { chef_version.satisfies?('~> 11.0') } # Ignore Chef 11
|
225
|
+
end
|
226
|
+
```
|
227
|
+
|
228
|
+
### Kernel
|
229
|
+
- `require_chef_gem` - "safely" require a gem. Loading a gem with Chef is sometimes difficult and confusing. The errors that Chef produces are also sometimes not very intuitive. In the event you require a gem to exist on the system, you can use `require_chef_gem`, which will attempt to require the gem and then produce helpful output if the gem is not installed:
|
230
|
+
|
231
|
+
Chef could not load the gem `#{name}'! You may need to install the gem
|
232
|
+
manually with `gem install #{name}', or include a recipe before you can
|
233
|
+
use this resource. Please consult the documentation for this cookbook
|
234
|
+
for proper usage.
|
235
|
+
|
236
|
+
#### Examples
|
237
|
+
```ruby
|
238
|
+
# LWRP
|
239
|
+
require_chef_gem 'pry'
|
240
|
+
```
|
241
|
+
|
242
|
+
```ruby
|
243
|
+
class Chef
|
244
|
+
class Provider
|
245
|
+
class MyProvider > Provider
|
246
|
+
require_chef_gem 'pry'
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
```
|
251
|
+
|
252
|
+
### IP
|
253
|
+
- `best_ip_for` - determine the best IP address for the given "other" node, preferring local IP addresses over public ones.
|
254
|
+
|
255
|
+
#### Examples
|
256
|
+
```ruby
|
257
|
+
redis = search('node', 'role:redis').first
|
258
|
+
|
259
|
+
template '/tmp/config' do
|
260
|
+
variables(
|
261
|
+
ipaddress: best_ip_for(redis)
|
262
|
+
)
|
263
|
+
end
|
264
|
+
```
|
265
|
+
|
266
|
+
### Node
|
267
|
+
|
268
|
+
Additional methods for the `node` object
|
269
|
+
|
270
|
+
- `deep_fetch` - safely fetch a nested attribute.
|
271
|
+
- `deep_fetch!` - fetch a nested attribute, raising a more semantic error if the key does not exist.
|
272
|
+
- `in?` - determine if the node is in the given Chef environment.
|
273
|
+
|
274
|
+
#### Examples
|
275
|
+
```ruby
|
276
|
+
credentials = if node.in?('production')
|
277
|
+
Chef::EncryptedDataBag.new('...')
|
278
|
+
else
|
279
|
+
data_bag('...')
|
280
|
+
end
|
281
|
+
```
|
282
|
+
|
283
|
+
```ruby
|
284
|
+
node.deep_fetch('apache2', 'config', 'root') => node['apache2']['config']['root']
|
285
|
+
```
|
286
|
+
|
287
|
+
### Platform
|
288
|
+
- `amazon_linux?`
|
289
|
+
- `centos?`
|
290
|
+
- `linux_mint?`
|
291
|
+
- `oracle_linux?`
|
292
|
+
- `redhat_enterprise_linux?`
|
293
|
+
- `scientific_linux?`
|
294
|
+
- `ubuntu?`
|
295
|
+
- `solaris2?`
|
296
|
+
- `aix?`
|
297
|
+
- `smartos?`
|
298
|
+
- `omnios?`
|
299
|
+
|
300
|
+
There are also a series of dynamically defined matchers that map named operating system release versions and comparison operators in the form "#{platform}\_#{operator}\_#{name}?". For example:
|
301
|
+
|
302
|
+
- `debian_after_squeeze?`
|
303
|
+
- `linuxmint_after_or_at_olivia?`
|
304
|
+
- `mac_os_x_lion?`
|
305
|
+
- `ubuntu_before_lucid?`
|
306
|
+
- `ubuntu_before_or_at_maverick?`
|
307
|
+
- `solaris_10?`
|
308
|
+
- `solaris_11?`
|
309
|
+
|
310
|
+
To get a full list, run the following in IRB:
|
311
|
+
|
312
|
+
```ruby
|
313
|
+
require 'chef/sugar'
|
314
|
+
puts Chef::Sugar::Platform.instance_methods
|
315
|
+
```
|
316
|
+
|
317
|
+
#### Examples
|
318
|
+
```ruby
|
319
|
+
if ubuntu?
|
320
|
+
execute 'apt-get update'
|
321
|
+
end
|
322
|
+
```
|
323
|
+
|
324
|
+
### Platform Family
|
325
|
+
- `arch_linux?`
|
326
|
+
- `debian?`
|
327
|
+
- `fedora?`
|
328
|
+
- `freebsd?`
|
329
|
+
- `gentoo?`
|
330
|
+
- `linux?`
|
331
|
+
- `mac_os_x?`
|
332
|
+
- `openbsd?`
|
333
|
+
- `rhel?`
|
334
|
+
- `slackware?`
|
335
|
+
- `suse?`
|
336
|
+
- `windows?`
|
337
|
+
|
338
|
+
#### Examples
|
339
|
+
```ruby
|
340
|
+
node['attribute'] = if windows?
|
341
|
+
'C:\Foo\BarDrive'
|
342
|
+
else
|
343
|
+
'/foo/bar_drive'
|
344
|
+
end
|
345
|
+
```
|
346
|
+
|
347
|
+
### Ruby
|
348
|
+
**Note:** The applies to the Ruby found at `node['languages']['ruby']`.
|
349
|
+
|
350
|
+
- `ruby_20?`
|
351
|
+
- `ruby_19?`
|
352
|
+
|
353
|
+
#### Examples
|
354
|
+
```ruby
|
355
|
+
log 'This has been known to fail on Ruby 2.0' if ruby_20?
|
356
|
+
```
|
357
|
+
|
358
|
+
### Run Context
|
359
|
+
- `includes_recipe?` - determines if the current run context includes the recipe
|
360
|
+
|
361
|
+
```ruby
|
362
|
+
if includes_recipe?('apache2::default')
|
363
|
+
apache_module 'my_module' do
|
364
|
+
# ...
|
365
|
+
end
|
366
|
+
end
|
367
|
+
```
|
368
|
+
|
369
|
+
### Shell
|
370
|
+
- `which`
|
371
|
+
- `dev_null`
|
372
|
+
- `installed?`
|
373
|
+
- `installed_at_version?`
|
374
|
+
- `version_for`
|
375
|
+
|
376
|
+
#### Examples
|
377
|
+
```ruby
|
378
|
+
log "Using `mongo` at `#{which('mongo')}`"
|
379
|
+
|
380
|
+
if installed?('apt')
|
381
|
+
execute 'apt-get update'
|
382
|
+
end
|
383
|
+
|
384
|
+
execute 'install[thing]' do
|
385
|
+
command "... 2>&1 #{dev_null}"
|
386
|
+
not_if { installed_at_version?('thing', node['thing']['version']) }
|
387
|
+
end
|
388
|
+
|
389
|
+
log "Skipping git install, version is at #{version_for('mongo', '-v')}"
|
390
|
+
```
|
391
|
+
|
392
|
+
### Vagrant
|
393
|
+
- `vagrant?`
|
394
|
+
|
395
|
+
#### Examples
|
396
|
+
```ruby
|
397
|
+
http_request 'http://...' do
|
398
|
+
not_if { vagrant? }
|
399
|
+
end
|
400
|
+
```
|
401
|
+
|
402
|
+
### Virtualization
|
403
|
+
- `kvm?`
|
404
|
+
- `lxc?`
|
405
|
+
- `virtualbox?`
|
406
|
+
- `vmware?`
|
407
|
+
|
408
|
+
#### Examples
|
409
|
+
```ruby
|
410
|
+
service 'ntpd' do
|
411
|
+
action [:enable, :start]
|
412
|
+
not_if { lxc? }
|
413
|
+
end
|
414
|
+
```
|
415
|
+
|
416
|
+
### Filters
|
417
|
+
- `at_compile_time` - accepts a block of resources to run at compile time
|
418
|
+
- `before` - insert resource in the collection before the given resource
|
419
|
+
- `after` - insert resource in the collection after the given resource
|
420
|
+
|
421
|
+
#### Examples
|
422
|
+
```ruby
|
423
|
+
at_compile_time do
|
424
|
+
package 'apache2'
|
425
|
+
end
|
426
|
+
|
427
|
+
# This is equivalent to
|
428
|
+
package 'apache2' do
|
429
|
+
action :nothing
|
430
|
+
end.run_action(:install)
|
431
|
+
```
|
432
|
+
|
433
|
+
```ruby
|
434
|
+
before 'service[apache2]' do
|
435
|
+
log 'I am before the apache 2 service fires!'
|
436
|
+
end
|
437
|
+
```
|
438
|
+
|
439
|
+
```ruby
|
440
|
+
after 'service[apache2]' do
|
441
|
+
log 'I am after the apache 2 service fires!'
|
442
|
+
end
|
443
|
+
```
|
444
|
+
|
445
|
+
|
446
|
+
License & Authors
|
447
|
+
-----------------
|
448
|
+
- Author: Seth Vargo (sethvargo@gmail.com)
|
449
|
+
|
450
|
+
```text
|
451
|
+
Copyright 2013-2015 Seth Vargo
|
452
|
+
|
453
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
454
|
+
you may not use this file except in compliance with the License.
|
455
|
+
You may obtain a copy of the License at
|
456
|
+
|
457
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
458
|
+
|
459
|
+
Unless required by applicable law or agreed to in writing, software
|
460
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
461
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
462
|
+
See the License for the specific language governing permissions and
|
463
|
+
limitations under the License.
|
464
|
+
```
|