Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'separate-chef-client-service'

  • Loading branch information...
commit 3c255b6dbea9456d37f102e1f09ccde9a02bf37b 2 parents 417f695 + 50b4218
Joshua Timberman jtimberman authored
137 chef/README.md
Source Rendered
... ... @@ -1,7 +1,7 @@
1 1 BOOTSTRAP CHANGES
2 2 =================
3 3
4   -The `bootstrap` cookbook's recipes for configuring a RubyGem installation of Chef have been merged into this cookbook.
  4 +The `bootstrap` cookbook's recipes for configuring a RubyGem installation of Chef have been merged into this cookbook. Do not use the `bootstrap` cookbook on versions of Chef after 0.8.2.
5 5
6 6 bootstrap::client -> chef::bootstrap_client
7 7 bootstrap::server -> chef::bootstrap_server
@@ -13,6 +13,8 @@ Be aware of the following changes to this cookbook.
13 13 * We now set the signing key/cert locations and set owner / group. See the server.rb.erb template.
14 14 * The validation client name is configurable. See the attributes.
15 15
  16 +The client service setup has been moved from the `chef::bootstrap_client` recipe into its own recipe, `chef::client_service`. This is to improve use with Knife bootstrap which already configures the client configuration file.
  17 +
16 18 DESCRIPTION
17 19 ===========
18 20
@@ -30,7 +32,7 @@ Platform
30 32
31 33 If using this cookbook to manage a Chef Server system that was installed from Debian/Ubuntu packages, note that in the packages, the configuration files are split up for server.rb, solr.rb and webui.rb, and the `chef::server` recipe may not work as desired.
32 34
33   -We recommend using a recent version of Ubuntu or Debian for the Chef Server.
  35 +A recent version of Ubuntu or Debian is recommended for the Chef Server.
34 36
35 37 * Ubuntu 9.10/10.04
36 38 * Debian testing/unstable
@@ -53,7 +55,7 @@ Client
53 55 Server
54 56 ------
55 57
56   -The `chef::bootstrap_server` recipe uses the following other cookbooks from the Opscode repository.
  58 +The `chef::bootstrap_server` recipe uses the following other cookbooks from Opscode.
57 59
58 60 * couchdb
59 61 * `rabbitmq_chef`
@@ -78,21 +80,27 @@ umask
78 80
79 81 Sets the umask for files created by the server process via `Chef::Config[:umask]` in `/etc/chef/server.rb`
80 82
81   -url_type
82   ---------
  83 +`url_type`
  84 +----------
83 85
84 86 Set up the URLs the client should connect to with this. Default is `http`, which tells the client to connect to `http://server:4000`. If you set up your chef-server to use an SSL front-end for example with `chef::server_proxy`, set this to `https` for clients and the URLs will be `https://server/`.
85 87
86 88 By default the only URL config setting for Chef 0.8.x+ is `Chef::Config[:chef_server_url]`. The other older URLs are still supported so you can split out the various functions of the Chef Server, but configuration of those is outside the scope of this cookbook.
87 89
88   -init_style
89   -----------
  90 +`init_style`
  91 +------------
  92 +
  93 +Specifies the init style to use. Possible values:
90 94
91   -Specifies the init style to use. Default `runit`. Other possible values `init`, `bsd`, any other string will be treated as unknown and a message will be displayed during the Chef run.
  95 +* runit - uses runit to set up the service. Logs will be in `/etc/sv/chef-client/log/main`. Default value for this attribute.
  96 +* init - uses init scripts that are included in the `chef` gem. Logs will be in `/var/log/chef`. Only usable with debian/ubuntu and red hat family distributions.
  97 +* daemontools - uses daemontools to set up the service. Logs will be in `/etc/sv/chef-client/log/main`.
  98 +* bluepill - uses bluepill to set up the service.
  99 +* bsd - Prints a message with the chef-client command to use in rc.local.
92 100
93 101 If your platform doesn't have a `runit` package or if the cookbook doesn't detect it, but you still want to use runit, set `init_style` to `none` and install runit separately. You may need to configure the runit services separately.
94 102
95   -Using the `init` value for this attribute will retrieve the init scripts that are distributed with the Chef gem.
  103 +Using the `init` value for this attribute will retrieve the init scripts that are distributed with the Chef gem.
96 104
97 105 This cookbook does not yet support Upstart for Ubuntu/Debian, but that is planned for a future release, and will be specified via this attribute.
98 106
@@ -109,79 +117,79 @@ Any BSD and Gentoo:
109 117
110 118 * `/var/chef`
111 119
112   -run_path
113   ---------
  120 +`run_path`
  121 +----------
114 122
115 123 Location for pidfiles on systems using init scripts. Default `/var/run/chef`.
116 124
117 125 If `init_style` is `init`, this is used, and should match what the init script itself uses for the PID files.
118 126
119   -cache_path
120   -----------
  127 +`cache_path`
  128 +------------
121 129
122 130 Location where the client will cache cookbooks and other data. Default is `cache` underneath the `chef[:path]` location. Linux distributions adhering to the FHS prefer `/var/cache/chef` instead.
123 131
124 132 Base directory for data that is easily regenerated such as cookbook tarballs (`Chef::Config[:cookbook_tarballs]`) on the server, downloaded cookbooks on the client, etc. See the config templates.
125 133
126   -backup_path
127   ------------
  134 +`backup_path`
  135 +-------------
128 136
129 137 Location where backups of files, corresponds to the `file_backup_path` location. Defaults to `backup` under `chef[:path]` location. Set to `false` to use the old behavior which stores the backup files in the same directory as the target.
130 138
131 139 FHS location suggestion: `/var/lib/chef/backup`.
132 140
133   -serve_path
134   -----------
  141 +`serve_path`
  142 +------------
135 143
136 144 Used by the Chef server as the base location to "serve" cookbooks, roles and other assets. Default is `/srv/chef`.
137 145
138   -server_version
139   ---------------
  146 +`server_version`
  147 +----------------
140 148
141 149 Version of Chef to install for the server. Used by the `server_proxy` recipe to set the location of the DocumentRoot of the WebUI. Automatically determined via ohai's `chef_packages[:chef][:version]` by default.
142 150
143   -client_version
144   ---------------
  151 +`client_version`
  152 +----------------
145 153
146 154 Version of Chef to install for the client. Used to display a log message about the location of the init scripts when `init_style` is `init`, and can be used to upgrade `chef` gem with the `chef::bootstrap_client` recipe. Automatically determined via ohai's `chef_packages[:chef][:version]` by default.
147 155
148   -client_interval
149   ----------------
  156 +`client_interval`
  157 +-----------------
150 158
151 159 Number of seconds to run chef-client periodically. Default `1800` (30 minutes).
152 160
153   -client_splay
154   -------------
  161 +`client_splay`
  162 +--------------
155 163
156 164 Splay interval to randomly add to interval. Default `20`.
157 165
158   -log_dir
159   --------
  166 +`log_dir`
  167 +---------
160 168
161 169 When `init_style` is `init`, this directory needs to be created. The default is `/var/log/chef`.
162 170
163   -client_log, indexer_log, server_log
164   ------------------------------------
  171 +`client_log`, `indexer_log`, `server_log`
  172 +-----------------------------------------
165 173
166 174 These options are deprecated to reduce complexity and potential confusion.
167 175
168   -server_port
169   ------------
  176 +`server_port`
  177 +-------------
170 178
171 179 Port for the Server API service to listen on. Default `4000`.
172 180
173   -webui_port
174   -----------
  181 +`webui_port`
  182 +------------
175 183
176 184 Port for the Server WebUI service to listen on. Default `4040`.
177 185
178   -webui_enabled
179   --------------
  186 +`webui_enabled`
  187 +---------------
180 188
181 189 As of version 0.8.x+, the WebUI part of the Chef Server is optional, and disabled by default. To enable it, set this to true.
182 190
183   -server_fqdn
184   ------------
  191 +`server_fqdn`
  192 +-------------
185 193
186 194 Fully qualified domain name of the server. Default is `chef.domain` where domain is detected by Ohai. You should configure a DNS entry for your Chef Server.
187 195
@@ -189,8 +197,8 @@ On servers, this specifies the URL the server expects to use by default `Chef::C
189 197
190 198 On clients, this specifies the URL the client uses to connect to the server as `Chef::Config[:chef_server_url]`.
191 199
192   -server_url
193   -----------
  200 +`server_url`
  201 +------------
194 202
195 203 Full URI for the Chef Server. Used for `chef_server_url` config setting. The default value combines the attributes `chef.url_type`, `chef.server_fqdn` and `chef.server_port`, creating for example "http://chef.example.com:4000". If you are using the Opscode Platform, set this to "https://api.opscode.com/organizations/ORGNAME", where ORGNAME is your organization's simple string name.
196 204
@@ -199,13 +207,13 @@ SERVER PROXY
199 207
200 208 The following attributes are used by the `server_proxy.rb` recipe, and are stored in the `server_proxy.rb` attributes file.
201 209
202   -doc_root
203   ---------
  210 +`doc_root`
  211 +----------
204 212
205 213 DocumentRoot for the WebUI. Also gets set in the vhost for the API, but it is not used since the vhost merely proxies to the server on port 4000.
206 214
207   -server_ssl_req
208   ---------------
  215 +`server_ssl_req`
  216 +----------------
209 217
210 218 Used by the `server_proxy` recipe, this attribute can be used to set up a self-signed SSL certificate automatically using OpenSSL. Fields:
211 219
@@ -219,13 +227,13 @@ Used by the `server_proxy` recipe, this attribute can be used to set up a self-s
219 227
220 228 This attribute is now in the `server_proxy.rb` attributes file, as it is specific to that context.
221 229
222   -server_proxy.css_expire_hours
223   ------------------------------
  230 +`server_proxy.css_expire_hours`
  231 +-------------------------------
224 232
225 233 Sets expiration time for CSS in the WebUI.
226 234
227   -server_proxy.js_expire_hours
228   -----------------------------
  235 +`server_proxy.js_expire_hours`
  236 +------------------------------
229 237
230 238 Sets expiration time for JavaScript in the WebUI.
231 239
@@ -241,15 +249,15 @@ The first two recipes described are for "bootstrapping" a system to be a Chef Cl
241 249
242 250 These recipes are typically used with chef-solo using a JSON file of attributes and a run list, and a solo config file. For more information see [Bootstrap Chef RubyGems Installation](http://wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation) on the Chef Wiki.
243 251
244   -bootstrap_client
245   -----------------
  252 +`bootstrap_client`
  253 +------------------
246 254
247 255 ONLY FOR RUBYGEMS INSTALLATIONS. Do not use this recipe if you installed Chef from packages for your platform.
248 256
249 257 Use this recipe to "bootstrap" a client so it can connect to a Chef Server. This recipe does the following:
250 258
251 259 * Ensures the gem installed matches the version desired (`client_version` attribute).
252   -* Sets up the `chef-client` service depending on the `init_style` attribute (see above).
  260 +* Includes the `chef::client_service` recipe to ensure that `chef-client` is running as a service.
253 261 * Sets up some directories for Chef to use.
254 262 * Creates the client configuration file `/etc/chef/client.rb` based on the configuration passed via JSON.
255 263
@@ -273,8 +281,8 @@ For configuring a new client to connect to a local Chef Server:
273 281
274 282 This is the minimal JSON to use for the client configuration. See the ATTRIBUTES section above for more options.
275 283
276   -bootstrap_server
277   -----------------
  284 +`bootstrap_server`
  285 +------------------
278 286
279 287 ONLY FOR RUBYGEMS INSTALLATIONS. Do not use this recipe if you installed Chef from packages for your platform.
280 288
@@ -311,15 +319,22 @@ The recipe itself manages the `/etc/chef/client.rb` config file based on the att
311 319
312 320 This recipe does not manage the `chef-client` service. It is assumed to have been set up and started from the `bootstrap_client` recipe above, or from OS / distribution packaging. The `chef-client` service should not be restarted as a result of `/etc/chef/client.rb` changing, as that can cause the current process running the client to be restarted, having unpredictable results.
313 321
  322 +`client_service`
  323 +----------------
  324 +
  325 +Use this recipe on systems that should have a `chef-client` daemon running, such as when Knife bootstrap was used to install Chef on a new system.
  326 +
  327 +This recipe sets up the `chef-client` service depending on the `init_style` attribute (see above). It is included by the `chef::bootstrap_client` recipe.
  328 +
314 329 default
315 330 -------
316 331
317 332 There is no spoon :-).
318 333
319   -delete_validation
320   ------------------
  334 +`delete_validation`
  335 +-------------------
321 336
322   -This is a standalone recipe that merely deletes the validation certificate (default `/etc/chef/validation.pem`). Use this if managing the client config file is not required in your environment.
  337 +Use this recipe to delete the validation certificate (default `/etc/chef/validation.pem`) when using a `chef-client` after the client has been validated and authorized to connect to the server.
323 338
324 339 Beware if using this on your Chef Server. First copy the validation.pem certificate file to another location, such as your knife configuration directory (`~/.chef`) or [Chef Repository](http://wiki.opscode.com/display/chef/Chef+Repository).
325 340
@@ -341,8 +356,8 @@ Changes to the `/etc/chef/server.rb` will trigger a restart of these services.
341 356
342 357 Since the Chef Server itself typically runs the CouchDB service for the data store, the recipe will do a compaction on the Chef database and all the views associated with the Chef Server. These compactions only occur if the database/view size is more than 100Mb. It will use the configured CouchDB URL, which is `http://localhost:5984` by default. The actual value used for the CouchDB server is from the `Chef::Config[:couchdb_url]`, so this can be dynamically changed.
343 358
344   -server_proxy
345   -------------
  359 +`server_proxy`
  360 +--------------
346 361
347 362 This recipe sets up an Apache2 VirtualHost to proxy HTTPS for the Chef Server API and WebUI.
348 363
@@ -351,8 +366,8 @@ The API will be proxied on port 443. If the `chef-serer-webui` is installed, it
351 366 TEMPLATES
352 367 =========
353 368
354   -chef_server.conf.erb
355   ---------------------
  369 +`chef_server.conf.erb`
  370 +----------------------
356 371
357 372 VirtualHost file used by Apache2 in the `chef::server_proxy` recipe.
358 373
@@ -366,8 +381,8 @@ server.rb.erb
366 381
367 382 Configuration for the server and server components, lands in `/etc/chef/server.rb`. See above regarding Debian/Ubuntu packaging config files when using packages to install Chef.
368 383
369   -sv-*run.erb
370   ------------
  384 +`sv-*run.erb`
  385 +-------------
371 386
372 387 Various runit "run" scripts for the Chef services that get configured when `init_style` is "runit".
373 388
11 chef/metadata.json
... ... @@ -1,7 +1,7 @@
1 1 {
2 2 "name": "chef",
3 3 "description": "Installs and configures Chef for chef-client and chef-server",
4   - "long_description": "BOOTSTRAP CHANGES\n=================\n\nThe `bootstrap` cookbook's recipes for configuring a RubyGem installation of Chef have been merged into this cookbook.\n\n bootstrap::client -> chef::bootstrap_client\n bootstrap::server -> chef::bootstrap_server\n\nBe aware of the following changes to this cookbook.\n\n* Bootstrap no longer generates a random password for the webui admin user. The default password is displayed on the webui login page and should be changed immediately after logging in.\n* Server configuration now has a setting for the cookbook tarballs. See the server.rb.erb template.\n* We now set the signing key/cert locations and set owner / group. See the server.rb.erb template.\n* The validation client name is configurable. See the attributes.\n\nDESCRIPTION\n===========\n\nThis cookbook is used to configure the system to be a Chef Client or a Chef Server. It is a complex cookbook, please read this entire document to understand how it works. For more information on how Chef itself works, see the [Chef Wiki](http://wiki.opscode.com)\n\nREQUIREMENTS\n============\n\nChef 0.8.16 or later is required.\n\nChef 0.9.0 or later is required to use the `chef.init_style` attribute value `init`, in order to have the init scripts available.\n\nPlatform\n--------\n\nIf using this cookbook to manage a Chef Server system that was installed from Debian/Ubuntu packages, note that in the packages, the configuration files are split up for server.rb, solr.rb and webui.rb, and the `chef::server` recipe may not work as desired.\n\nWe recommend using a recent version of Ubuntu or Debian for the Chef Server.\n\n* Ubuntu 9.10/10.04\n* Debian testing/unstable\n\nThese versions have newer versions of CouchDB and RabbitMQ packaged.\n\n`chef::client` is tested on Ubuntu 8.04+, Debian 5.0, CentOS 5.x, Fedora 10+, OpenBSD 4.6, FreeBSD 7.1 and Gentoo.\n\n`chef::bootstrap_client` is tested on the above. OpenSolaris 11 is also tested, but there's a bug in Ohai that requires some manual intervention (OHAI-122).\n\n`chef::server` is tested on Ubuntu 8.04+, Debian 5.0.\n\n`chef::bootstrap_server` is tested on Ubuntu 8.04+, Debian 5.0.\n\nClient\n------\n\n`runit` cookbook is suggested for RubyGems installation. No other cookbooks are required for clients.\n\nServer\n------\n\nThe `chef::bootstrap_server` recipe uses the following other cookbooks from the Opscode repository.\n\n* couchdb\n* `rabbitmq_chef`\n* openssl\n* zlib\n* xml\n* java\n\nThe `chef::server_proxy` recipe uses the following cookbook:\n\n* apache2\n\nATTRIBUTES\n==========\n\nThe attributes for configuring the `chef` cookbook are under the `chef` namespace on the node, i.e., `@node[:chef]` or `@node.chef`.\n\nWhen using the bootstrap recipe, set the desired attributes using a JSON file. See \"BOOTSTRAPPING\" for examples.\n\numask\n-----\n\nSets the umask for files created by the server process via `Chef::Config[:umask]` in `/etc/chef/server.rb`\n\nurl_type\n--------\n\nSet up the URLs the client should connect to with this. Default is `http`, which tells the client to connect to `http://server:4000`. If you set up your chef-server to use an SSL front-end for example with `chef::server_proxy`, set this to `https` for clients and the URLs will be `https://server/`.\n\nBy default the only URL config setting for Chef 0.8.x+ is `Chef::Config[:chef_server_url]`. The other older URLs are still supported so you can split out the various functions of the Chef Server, but configuration of those is outside the scope of this cookbook.\n\ninit_style\n----------\n\nSpecifies the init style to use. Default `runit`. Other possible values `init`, `bsd`, any other string will be treated as unknown and a message will be displayed during the Chef run.\n\nIf your platform doesn't have a `runit` package or if the cookbook doesn't detect it, but you still want to use runit, set `init_style` to `none` and install runit separately. You may need to configure the runit services separately.\n\nUsing the `init` value for this attribute will retrieve the init scripts that are distributed with the Chef gem. \n\nThis cookbook does not yet support Upstart for Ubuntu/Debian, but that is planned for a future release, and will be specified via this attribute.\n\npath\n----\n\nThis is the base location where Chef will store data and other artifacts. Default `/srv/chef` for RubyGems installed systems. If using Chef packages for your platform, the location preference varies. The default on Debian and Red Hat based systems is a filesystem hiearchy standard (FHS) suggestion. Some other locations you may consider, by platform:\n\nDebian and Red Hat based Linux distros (Ubuntu, CentOS, Fedora, etc):\n\n* `/var/lib/chef`\n\nAny BSD and Gentoo:\n\n* `/var/chef`\n\nrun_path\n--------\n\nLocation for pidfiles on systems using init scripts. Default `/var/run/chef`.\n\nIf `init_style` is `init`, this is used, and should match what the init script itself uses for the PID files.\n\ncache_path\n----------\n\nLocation where the client will cache cookbooks and other data. Default is `cache` underneath the `chef[:path]` location. Linux distributions adhering to the FHS prefer `/var/cache/chef` instead.\n\nBase directory for data that is easily regenerated such as cookbook tarballs (`Chef::Config[:cookbook_tarballs]`) on the server, downloaded cookbooks on the client, etc. See the config templates.\n\nbackup_path\n-----------\n\nLocation where backups of files, corresponds to the `file_backup_path` location. Defaults to `backup` under `chef[:path]` location. Set to `false` to use the old behavior which stores the backup files in the same directory as the target.\n\nFHS location suggestion: `/var/lib/chef/backup`.\n\nserve_path\n----------\n\nUsed by the Chef server as the base location to \"serve\" cookbooks, roles and other assets. Default is `/srv/chef`.\n\nserver_version\n--------------\n\nVersion of Chef to install for the server. Used by the `server_proxy` recipe to set the location of the DocumentRoot of the WebUI. Automatically determined via ohai's `chef_packages[:chef][:version]` by default.\n\nclient_version\n--------------\n\nVersion of Chef to install for the client. Used to display a log message about the location of the init scripts when `init_style` is `init`, and can be used to upgrade `chef` gem with the `chef::bootstrap_client` recipe. Automatically determined via ohai's `chef_packages[:chef][:version]` by default.\n\nclient_interval\n---------------\n\nNumber of seconds to run chef-client periodically. Default `1800` (30 minutes).\n\nclient_splay\n------------\n\nSplay interval to randomly add to interval. Default `20`.\n\nlog_dir\n-------\n\nWhen `init_style` is `init`, this directory needs to be created. The default is `/var/log/chef`.\n\nclient_log, indexer_log, server_log\n-----------------------------------\n\nThese options are deprecated to reduce complexity and potential confusion.\n\nserver_port\n-----------\n\nPort for the Server API service to listen on. Default `4000`.\n\nwebui_port\n----------\n\nPort for the Server WebUI service to listen on. Default `4040`.\n\nwebui_enabled\n-------------\n\nAs of version 0.8.x+, the WebUI part of the Chef Server is optional, and disabled by default. To enable it, set this to true.\n\nserver_fqdn\n-----------\n\nFully qualified domain name of the server. Default is `chef.domain` where domain is detected by Ohai. You should configure a DNS entry for your Chef Server.\n\nOn servers, this specifies the URL the server expects to use by default `Chef::Config[:chef_server_url]`, plus it is used in the `server_ssl_req` as the canonical name (CN) and in `server_proxy` for the vhost name.\n\nOn clients, this specifies the URL the client uses to connect to the server as `Chef::Config[:chef_server_url]`.\n\nserver_url\n----------\n\nFull URI for the Chef Server. Used for `chef_server_url` config setting. The default value combines the attributes `chef.url_type`, `chef.server_fqdn` and `chef.server_port`, creating for example \"http://chef.example.com:4000\". If you are using the Opscode Platform, set this to \"https://api.opscode.com/organizations/ORGNAME\", where ORGNAME is your organization's simple string name.\n\nSERVER PROXY\n------------\n\nThe following attributes are used by the `server_proxy.rb` recipe, and are stored in the `server_proxy.rb` attributes file.\n\ndoc_root\n--------\n\nDocumentRoot for the WebUI. Also gets set in the vhost for the API, but it is not used since the vhost merely proxies to the server on port 4000.\n\nserver_ssl_req\n--------------\n\nUsed by the `server_proxy` recipe, this attribute can be used to set up a self-signed SSL certificate automatically using OpenSSL. Fields:\n\n* C: country (two letter code)\n* ST: state/province\n* L: locality or city\n* O: organization\n* OU: organizational unit\n* CN: canonical name, usually the fully qualified domain name of the server (FQDN)\n* emailAddress: contact email address\n\nThis attribute is now in the `server_proxy.rb` attributes file, as it is specific to that context.\n\nserver_proxy.css_expire_hours\n-----------------------------\n\nSets expiration time for CSS in the WebUI.\n\nserver_proxy.js_expire_hours\n----------------------------\n\nSets expiration time for JavaScript in the WebUI.\n\nRECIPES AND USAGE\n=================\n\nThis section describes the recipes in the cookbook and how to use them in your environment.\n\nBOOTSTRAPPING\n-------------\n\nThe first two recipes described are for \"bootstrapping\" a system to be a Chef Client or Chef Server, respectively. Only use these recipes with RubyGems installations of Chef.\n\nThese recipes are typically used with chef-solo using a JSON file of attributes and a run list, and a solo config file. For more information see [Bootstrap Chef RubyGems Installation](http://wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation) on the Chef Wiki.\n\nbootstrap_client\n----------------\n\nONLY FOR RUBYGEMS INSTALLATIONS. Do not use this recipe if you installed Chef from packages for your platform.\n\nUse this recipe to \"bootstrap\" a client so it can connect to a Chef Server. This recipe does the following:\n\n* Ensures the gem installed matches the version desired (`client_version` attribute).\n* Sets up the `chef-client` service depending on the `init_style` attribute (see above).\n* Sets up some directories for Chef to use.\n* Creates the client configuration file `/etc/chef/client.rb` based on the configuration passed via JSON.\n\nFor configuring a new client to connect to the Opscode Platform:\n\n {\n \"chef\": {\n \"server_url\": \"https://api.opscode.com/organizations/ORGNAME\"\n },\n \"run_list\": \"recipe[chef::bootstrap_client]\"\n }\n\nFor configuring a new client to connect to a local Chef Server:\n\n {\n \"chef\": {\n \"server_url\": \"http://chef.example.com:4000\"\n },\n \"run_list\": \"recipe[chef::bootstrap_client]\"\n }\n\nThis is the minimal JSON to use for the client configuration. See the ATTRIBUTES section above for more options.\n\nbootstrap_server\n----------------\n\nONLY FOR RUBYGEMS INSTALLATIONS. Do not use this recipe if you installed Chef from packages for your platform.\n\nUse this recipe to \"bootstrap\" a system to become a Chef Server. This recipe does the following:\n\n* Includes the `chef::bootstrap_client` recipe to configure itself to be its own client.\n* Installs CouchDB from package or source depending on the platform.\n* Installs Java for the `chef-solr` search engine.\n* Installs RabbitMQ (`rabbitmq_chef` cookbook) for the `chef-solr-indexer` consumer.\n* Installs all the Server-related Gems.\n* Creates the server configuration file `/etc/chef/server.rb` based on the configuration passed via JSON.\n* Sets up some directories for the server to use.\n* Sets up the `chef-server`, `chef-solr`, `chef-solr-indexer` services depending on the `init_style` attribute (see above).\n\nMinimal JSON to use for the server configuration:\n\n {\n \"chef\": {\n \"server_url\": \"http://localhost.localdomain:4000\",\n },\n \"run_list\": \"recipe[chef::bootstrap_server]\"\n }\n\nNote that the `chef-server-webui` is optional and can be enabled if desired by adding this to the JSON under \"chef\":\n\n \"webui_enabled\": true\n\nclient\n------\n\nThe client recipe is used to manage the configuration of an already-installed and configured Chef client. It can be used after a RubyGems installation bootstrap (per above), or with clients that were installed from platform packaging.\n\nThe recipe itself manages the `/etc/chef/client.rb` config file based on the attributes in this cookbook. When the client config is updated, the recipe will also reread the configuration during the Chef run, so the current Chef run can be dynamically changed.\n\nThis recipe does not manage the `chef-client` service. It is assumed to have been set up and started from the `bootstrap_client` recipe above, or from OS / distribution packaging. The `chef-client` service should not be restarted as a result of `/etc/chef/client.rb` changing, as that can cause the current process running the client to be restarted, having unpredictable results.\n\ndefault\n-------\n\nThere is no spoon :-).\n\ndelete_validation\n-----------------\n\nThis is a standalone recipe that merely deletes the validation certificate (default `/etc/chef/validation.pem`). Use this if managing the client config file is not required in your environment.\n\nBeware if using this on your Chef Server. First copy the validation.pem certificate file to another location, such as your knife configuration directory (`~/.chef`) or [Chef Repository](http://wiki.opscode.com/display/chef/Chef+Repository).\n\nserver\n------\n\nThe server recipe includes the `chef::client` recipe above.\n\nThe recipe itself manages the services and the Server config file `/etc/chef/server.rb`. See above under Platform requirements for cavaet when running Chef Server installed via Debian/Ubuntu packages. Changes to the recipe to manage additional templates may be required.\n\nThe following services are managed:\n\n* chef-solr\n* chef-solr-indexer\n* chef-server\n* chef-webui (if installed)\n\nChanges to the `/etc/chef/server.rb` will trigger a restart of these services.\n\nSince the Chef Server itself typically runs the CouchDB service for the data store, the recipe will do a compaction on the Chef database and all the views associated with the Chef Server. These compactions only occur if the database/view size is more than 100Mb. It will use the configured CouchDB URL, which is `http://localhost:5984` by default. The actual value used for the CouchDB server is from the `Chef::Config[:couchdb_url]`, so this can be dynamically changed.\n\nserver_proxy\n------------\n\nThis recipe sets up an Apache2 VirtualHost to proxy HTTPS for the Chef Server API and WebUI.\n\nThe API will be proxied on port 443. If the `chef-serer-webui` is installed, it will be proxied on port 444. The recipe dynamically creates the OpenSSL certificate based on the `chef.server_ssl_req` attribute. It uses some additional configuration for Apache to improve performance of the webui. The virtual host template is `chef_server.conf.erb`. The DocumentRoot setting is used for the WebUI, but not the API, and is set with the attribute `chef.doc_root`.\n\nTEMPLATES\n=========\n\nchef_server.conf.erb\n--------------------\n\nVirtualHost file used by Apache2 in the `chef::server_proxy` recipe.\n\nclient.rb.erb\n-------------\n\nConfiguration for the client, lands in `/etc/chef/client.rb`.\n\nserver.rb.erb\n-------------\n\nConfiguration for the server and server components, lands in `/etc/chef/server.rb`. See above regarding Debian/Ubuntu packaging config files when using packages to install Chef.\n\nsv-*run.erb\n-----------\n\nVarious runit \"run\" scripts for the Chef services that get configured when `init_style` is \"runit\".\n\nLICENSE AND AUTHORS\n===================\n\n* Author: Joshua Timberman <joshua@opscode.com>\n* Author: Joshua Sierles <joshua@37signals.com>\n\n* Copyright 2008-2010, Opscode, Inc\n* Copyright 2009, 37signals\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\n",
  4 + "long_description": "BOOTSTRAP CHANGES\n=================\n\nThe `bootstrap` cookbook's recipes for configuring a RubyGem installation of Chef have been merged into this cookbook. Do not use the `bootstrap` cookbook on versions of Chef after 0.8.2.\n\n bootstrap::client -> chef::bootstrap_client\n bootstrap::server -> chef::bootstrap_server\n\nBe aware of the following changes to this cookbook.\n\n* Bootstrap no longer generates a random password for the webui admin user. The default password is displayed on the webui login page and should be changed immediately after logging in.\n* Server configuration now has a setting for the cookbook tarballs. See the server.rb.erb template.\n* We now set the signing key/cert locations and set owner / group. See the server.rb.erb template.\n* The validation client name is configurable. See the attributes.\n\nThe client service setup has been moved from the `chef::bootstrap_client` recipe into its own recipe, `chef::client_service`. This is to improve use with Knife bootstrap which already configures the client configuration file.\n\nDESCRIPTION\n===========\n\nThis cookbook is used to configure the system to be a Chef Client or a Chef Server. It is a complex cookbook, please read this entire document to understand how it works. For more information on how Chef itself works, see the [Chef Wiki](http://wiki.opscode.com)\n\nREQUIREMENTS\n============\n\nChef 0.8.16 or later is required.\n\nChef 0.9.0 or later is required to use the `chef.init_style` attribute value `init`, in order to have the init scripts available.\n\nPlatform\n--------\n\nIf using this cookbook to manage a Chef Server system that was installed from Debian/Ubuntu packages, note that in the packages, the configuration files are split up for server.rb, solr.rb and webui.rb, and the `chef::server` recipe may not work as desired.\n\nA recent version of Ubuntu or Debian is recommended for the Chef Server.\n\n* Ubuntu 9.10/10.04\n* Debian testing/unstable\n\nThese versions have newer versions of CouchDB and RabbitMQ packaged.\n\n`chef::client` is tested on Ubuntu 8.04+, Debian 5.0, CentOS 5.x, Fedora 10+, OpenBSD 4.6, FreeBSD 7.1 and Gentoo.\n\n`chef::bootstrap_client` is tested on the above. OpenSolaris 11 is also tested, but there's a bug in Ohai that requires some manual intervention (OHAI-122).\n\n`chef::server` is tested on Ubuntu 8.04+, Debian 5.0.\n\n`chef::bootstrap_server` is tested on Ubuntu 8.04+, Debian 5.0.\n\nClient\n------\n\n`runit` cookbook is suggested for RubyGems installation. No other cookbooks are required for clients.\n\nServer\n------\n\nThe `chef::bootstrap_server` recipe uses the following other cookbooks from Opscode.\n\n* couchdb\n* `rabbitmq_chef`\n* openssl\n* zlib\n* xml\n* java\n\nThe `chef::server_proxy` recipe uses the following cookbook:\n\n* apache2\n\nATTRIBUTES\n==========\n\nThe attributes for configuring the `chef` cookbook are under the `chef` namespace on the node, i.e., `@node[:chef]` or `@node.chef`.\n\nWhen using the bootstrap recipe, set the desired attributes using a JSON file. See \"BOOTSTRAPPING\" for examples.\n\numask\n-----\n\nSets the umask for files created by the server process via `Chef::Config[:umask]` in `/etc/chef/server.rb`\n\n`url_type`\n----------\n\nSet up the URLs the client should connect to with this. Default is `http`, which tells the client to connect to `http://server:4000`. If you set up your chef-server to use an SSL front-end for example with `chef::server_proxy`, set this to `https` for clients and the URLs will be `https://server/`.\n\nBy default the only URL config setting for Chef 0.8.x+ is `Chef::Config[:chef_server_url]`. The other older URLs are still supported so you can split out the various functions of the Chef Server, but configuration of those is outside the scope of this cookbook.\n\n`init_style`\n------------\n\nSpecifies the init style to use. Possible values:\n\n* runit - uses runit to set up the service. Logs will be in `/etc/sv/chef-client/log/main`. Default value for this attribute.\n* init - uses init scripts that are included in the `chef` gem. Logs will be in `/var/log/chef`. Only usable with debian/ubuntu and red hat family distributions.\n* daemontools - uses daemontools to set up the service. Logs will be in `/etc/sv/chef-client/log/main`.\n* bluepill - uses bluepill to set up the service.\n* bsd - Prints a message with the chef-client command to use in rc.local.\n\nIf your platform doesn't have a `runit` package or if the cookbook doesn't detect it, but you still want to use runit, set `init_style` to `none` and install runit separately. You may need to configure the runit services separately.\n\nUsing the `init` value for this attribute will retrieve the init scripts that are distributed with the Chef gem.\n\nThis cookbook does not yet support Upstart for Ubuntu/Debian, but that is planned for a future release, and will be specified via this attribute.\n\npath\n----\n\nThis is the base location where Chef will store data and other artifacts. Default `/srv/chef` for RubyGems installed systems. If using Chef packages for your platform, the location preference varies. The default on Debian and Red Hat based systems is a filesystem hiearchy standard (FHS) suggestion. Some other locations you may consider, by platform:\n\nDebian and Red Hat based Linux distros (Ubuntu, CentOS, Fedora, etc):\n\n* `/var/lib/chef`\n\nAny BSD and Gentoo:\n\n* `/var/chef`\n\n`run_path`\n----------\n\nLocation for pidfiles on systems using init scripts. Default `/var/run/chef`.\n\nIf `init_style` is `init`, this is used, and should match what the init script itself uses for the PID files.\n\n`cache_path`\n------------\n\nLocation where the client will cache cookbooks and other data. Default is `cache` underneath the `chef[:path]` location. Linux distributions adhering to the FHS prefer `/var/cache/chef` instead.\n\nBase directory for data that is easily regenerated such as cookbook tarballs (`Chef::Config[:cookbook_tarballs]`) on the server, downloaded cookbooks on the client, etc. See the config templates.\n\n`backup_path`\n-------------\n\nLocation where backups of files, corresponds to the `file_backup_path` location. Defaults to `backup` under `chef[:path]` location. Set to `false` to use the old behavior which stores the backup files in the same directory as the target.\n\nFHS location suggestion: `/var/lib/chef/backup`.\n\n`serve_path`\n------------\n\nUsed by the Chef server as the base location to \"serve\" cookbooks, roles and other assets. Default is `/srv/chef`.\n\n`server_version`\n----------------\n\nVersion of Chef to install for the server. Used by the `server_proxy` recipe to set the location of the DocumentRoot of the WebUI. Automatically determined via ohai's `chef_packages[:chef][:version]` by default.\n\n`client_version`\n----------------\n\nVersion of Chef to install for the client. Used to display a log message about the location of the init scripts when `init_style` is `init`, and can be used to upgrade `chef` gem with the `chef::bootstrap_client` recipe. Automatically determined via ohai's `chef_packages[:chef][:version]` by default.\n\n`client_interval`\n-----------------\n\nNumber of seconds to run chef-client periodically. Default `1800` (30 minutes).\n\n`client_splay`\n--------------\n\nSplay interval to randomly add to interval. Default `20`.\n\n`log_dir`\n---------\n\nWhen `init_style` is `init`, this directory needs to be created. The default is `/var/log/chef`.\n\n`client_log`, `indexer_log`, `server_log`\n-----------------------------------------\n\nThese options are deprecated to reduce complexity and potential confusion.\n\n`server_port`\n-------------\n\nPort for the Server API service to listen on. Default `4000`.\n\n`webui_port`\n------------\n\nPort for the Server WebUI service to listen on. Default `4040`.\n\n`webui_enabled`\n---------------\n\nAs of version 0.8.x+, the WebUI part of the Chef Server is optional, and disabled by default. To enable it, set this to true.\n\n`server_fqdn`\n-------------\n\nFully qualified domain name of the server. Default is `chef.domain` where domain is detected by Ohai. You should configure a DNS entry for your Chef Server.\n\nOn servers, this specifies the URL the server expects to use by default `Chef::Config[:chef_server_url]`, plus it is used in the `server_ssl_req` as the canonical name (CN) and in `server_proxy` for the vhost name.\n\nOn clients, this specifies the URL the client uses to connect to the server as `Chef::Config[:chef_server_url]`.\n\n`server_url`\n------------\n\nFull URI for the Chef Server. Used for `chef_server_url` config setting. The default value combines the attributes `chef.url_type`, `chef.server_fqdn` and `chef.server_port`, creating for example \"http://chef.example.com:4000\". If you are using the Opscode Platform, set this to \"https://api.opscode.com/organizations/ORGNAME\", where ORGNAME is your organization's simple string name.\n\nSERVER PROXY\n------------\n\nThe following attributes are used by the `server_proxy.rb` recipe, and are stored in the `server_proxy.rb` attributes file.\n\n`doc_root`\n----------\n\nDocumentRoot for the WebUI. Also gets set in the vhost for the API, but it is not used since the vhost merely proxies to the server on port 4000.\n\n`server_ssl_req`\n----------------\n\nUsed by the `server_proxy` recipe, this attribute can be used to set up a self-signed SSL certificate automatically using OpenSSL. Fields:\n\n* C: country (two letter code)\n* ST: state/province\n* L: locality or city\n* O: organization\n* OU: organizational unit\n* CN: canonical name, usually the fully qualified domain name of the server (FQDN)\n* emailAddress: contact email address\n\nThis attribute is now in the `server_proxy.rb` attributes file, as it is specific to that context.\n\n`server_proxy.css_expire_hours`\n-------------------------------\n\nSets expiration time for CSS in the WebUI.\n\n`server_proxy.js_expire_hours`\n------------------------------\n\nSets expiration time for JavaScript in the WebUI.\n\nRECIPES AND USAGE\n=================\n\nThis section describes the recipes in the cookbook and how to use them in your environment.\n\nBOOTSTRAPPING\n-------------\n\nThe first two recipes described are for \"bootstrapping\" a system to be a Chef Client or Chef Server, respectively. Only use these recipes with RubyGems installations of Chef.\n\nThese recipes are typically used with chef-solo using a JSON file of attributes and a run list, and a solo config file. For more information see [Bootstrap Chef RubyGems Installation](http://wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation) on the Chef Wiki.\n\n`bootstrap_client`\n------------------\n\nONLY FOR RUBYGEMS INSTALLATIONS. Do not use this recipe if you installed Chef from packages for your platform.\n\nUse this recipe to \"bootstrap\" a client so it can connect to a Chef Server. This recipe does the following:\n\n* Ensures the gem installed matches the version desired (`client_version` attribute).\n* Includes the `chef::client_service` recipe to ensure that `chef-client` is running as a service.\n* Sets up some directories for Chef to use.\n* Creates the client configuration file `/etc/chef/client.rb` based on the configuration passed via JSON.\n\nFor configuring a new client to connect to the Opscode Platform:\n\n {\n \"chef\": {\n \"server_url\": \"https://api.opscode.com/organizations/ORGNAME\"\n },\n \"run_list\": \"recipe[chef::bootstrap_client]\"\n }\n\nFor configuring a new client to connect to a local Chef Server:\n\n {\n \"chef\": {\n \"server_url\": \"http://chef.example.com:4000\"\n },\n \"run_list\": \"recipe[chef::bootstrap_client]\"\n }\n\nThis is the minimal JSON to use for the client configuration. See the ATTRIBUTES section above for more options.\n\n`bootstrap_server`\n------------------\n\nONLY FOR RUBYGEMS INSTALLATIONS. Do not use this recipe if you installed Chef from packages for your platform.\n\nUse this recipe to \"bootstrap\" a system to become a Chef Server. This recipe does the following:\n\n* Includes the `chef::bootstrap_client` recipe to configure itself to be its own client.\n* Installs CouchDB from package or source depending on the platform.\n* Installs Java for the `chef-solr` search engine.\n* Installs RabbitMQ (`rabbitmq_chef` cookbook) for the `chef-solr-indexer` consumer.\n* Installs all the Server-related Gems.\n* Creates the server configuration file `/etc/chef/server.rb` based on the configuration passed via JSON.\n* Sets up some directories for the server to use.\n* Sets up the `chef-server`, `chef-solr`, `chef-solr-indexer` services depending on the `init_style` attribute (see above).\n\nMinimal JSON to use for the server configuration:\n\n {\n \"chef\": {\n \"server_url\": \"http://localhost.localdomain:4000\",\n },\n \"run_list\": \"recipe[chef::bootstrap_server]\"\n }\n\nNote that the `chef-server-webui` is optional and can be enabled if desired by adding this to the JSON under \"chef\":\n\n \"webui_enabled\": true\n\nclient\n------\n\nThe client recipe is used to manage the configuration of an already-installed and configured Chef client. It can be used after a RubyGems installation bootstrap (per above), or with clients that were installed from platform packaging.\n\nThe recipe itself manages the `/etc/chef/client.rb` config file based on the attributes in this cookbook. When the client config is updated, the recipe will also reread the configuration during the Chef run, so the current Chef run can be dynamically changed.\n\nThis recipe does not manage the `chef-client` service. It is assumed to have been set up and started from the `bootstrap_client` recipe above, or from OS / distribution packaging. The `chef-client` service should not be restarted as a result of `/etc/chef/client.rb` changing, as that can cause the current process running the client to be restarted, having unpredictable results.\n\n`client_service`\n----------------\n\nUse this recipe on systems that should have a `chef-client` daemon running, such as when Knife bootstrap was used to install Chef on a new system.\n\nThis recipe sets up the `chef-client` service depending on the `init_style` attribute (see above). It is included by the `chef::bootstrap_client` recipe.\n\ndefault\n-------\n\nThere is no spoon :-).\n\n`delete_validation`\n-------------------\n\nUse this recipe to delete the validation certificate (default `/etc/chef/validation.pem`) when using a `chef-client` after the client has been validated and authorized to connect to the server.\n\nBeware if using this on your Chef Server. First copy the validation.pem certificate file to another location, such as your knife configuration directory (`~/.chef`) or [Chef Repository](http://wiki.opscode.com/display/chef/Chef+Repository).\n\nserver\n------\n\nThe server recipe includes the `chef::client` recipe above.\n\nThe recipe itself manages the services and the Server config file `/etc/chef/server.rb`. See above under Platform requirements for cavaet when running Chef Server installed via Debian/Ubuntu packages. Changes to the recipe to manage additional templates may be required.\n\nThe following services are managed:\n\n* chef-solr\n* chef-solr-indexer\n* chef-server\n* chef-webui (if installed)\n\nChanges to the `/etc/chef/server.rb` will trigger a restart of these services.\n\nSince the Chef Server itself typically runs the CouchDB service for the data store, the recipe will do a compaction on the Chef database and all the views associated with the Chef Server. These compactions only occur if the database/view size is more than 100Mb. It will use the configured CouchDB URL, which is `http://localhost:5984` by default. The actual value used for the CouchDB server is from the `Chef::Config[:couchdb_url]`, so this can be dynamically changed.\n\n`server_proxy`\n--------------\n\nThis recipe sets up an Apache2 VirtualHost to proxy HTTPS for the Chef Server API and WebUI.\n\nThe API will be proxied on port 443. If the `chef-serer-webui` is installed, it will be proxied on port 444. The recipe dynamically creates the OpenSSL certificate based on the `chef.server_ssl_req` attribute. It uses some additional configuration for Apache to improve performance of the webui. The virtual host template is `chef_server.conf.erb`. The DocumentRoot setting is used for the WebUI, but not the API, and is set with the attribute `chef.doc_root`.\n\nTEMPLATES\n=========\n\n`chef_server.conf.erb`\n----------------------\n\nVirtualHost file used by Apache2 in the `chef::server_proxy` recipe.\n\nclient.rb.erb\n-------------\n\nConfiguration for the client, lands in `/etc/chef/client.rb`.\n\nserver.rb.erb\n-------------\n\nConfiguration for the server and server components, lands in `/etc/chef/server.rb`. See above regarding Debian/Ubuntu packaging config files when using packages to install Chef.\n\n`sv-*run.erb`\n-------------\n\nVarious runit \"run\" scripts for the Chef services that get configured when `init_style` is \"runit\".\n\nLICENSE AND AUTHORS\n===================\n\n* Author: Joshua Timberman <joshua@opscode.com>\n* Author: Joshua Sierles <joshua@37signals.com>\n\n* Copyright 2008-2010, Opscode, Inc\n* Copyright 2009, 37signals\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\n",
5 5 "maintainer": "Opscode, Inc.",
6 6 "maintainer_email": "cookbooks@opscode.com",
7 7 "license": "Apache 2.0",
@@ -32,6 +32,12 @@
32 32 "runit": [
33 33
34 34 ],
  35 + "bluepill": [
  36 +
  37 + ],
  38 + "daemontools": [
  39 +
  40 + ],
35 41 "couchdb": [
36 42
37 43 ],
@@ -71,11 +77,12 @@
71 77 "recipes": {
72 78 "chef": "Default recipe is empty, use one of the other recipes.",
73 79 "chef::client": "Sets up a client to talk to a chef-server",
  80 + "chef::client_service": "Sets up a client daemon to run periodically",
74 81 "chef::bootstrap_client": "Set up rubygem installed chef client",
75 82 "chef::delete_validation": "Deletes validation.pem after client registers",
76 83 "chef::server": "Configures a chef API server as a merb application",
77 84 "chef::bootstrap_server": "Set up rubygem installed chef server",
78 85 "chef::server_proxy": "Configures Apache2 proxy for API and WebUI"
79 86 },
80   - "version": "0.21.3"
  87 + "version": "0.22.0"
81 88 }
5 chef/metadata.rb
@@ -3,9 +3,10 @@
3 3 license "Apache 2.0"
4 4 description "Installs and configures Chef for chef-client and chef-server"
5 5 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6   -version "0.21.3"
  6 +version "0.22.0"
7 7 recipe "chef", "Default recipe is empty, use one of the other recipes."
8 8 recipe "chef::client", "Sets up a client to talk to a chef-server"
  9 +recipe "chef::client_service", "Sets up a client daemon to run periodically"
9 10 recipe "chef::bootstrap_client", "Set up rubygem installed chef client"
10 11 recipe "chef::delete_validation", "Deletes validation.pem after client registers"
11 12 recipe "chef::server", "Configures a chef API server as a merb application"
@@ -16,6 +17,6 @@
16 17 supports os
17 18 end
18 19
19   -%w{ runit couchdb rabbitmq_chef apache2 openssl zlib xml java }.each do |cb|
  20 +%w{ runit bluepill daemontools couchdb rabbitmq_chef apache2 openssl zlib xml java }.each do |cb|
20 21 depends cb
21 22 end
51 chef/recipes/bootstrap_client.rb
@@ -49,53 +49,4 @@
49 49 mode "644"
50 50 end
51 51
52   -case node[:chef][:init_style]
53   -when "runit"
54   -
55   - include_recipe "runit"
56   - runit_service "chef-client"
57   -
58   -when "init"
59   -
60   - directory node[:chef][:run_path] do
61   - action :create
62   - owner "root"
63   - group root_group
64   - mode "755"
65   - end
66   -
67   - dist_dir = value_for_platform(
68   - ["ubuntu", "debian"] => { "default" => "debian" },
69   - ["redhat", "centos", "fedora"] => { "default" => "redhat"}
70   - )
71   -
72   - conf_dir = value_for_platform(
73   - ["ubuntu", "debian"] => { "default" => "default" },
74   - ["redhat", "centos", "fedora"] => { "default" => "sysconfig"}
75   - )
76   -
77   - chef_version = node.chef_packages.chef[:version]
78   -
79   - init_content = IO.read("#{node.languages.ruby.gems_dir}/gems/chef-#{chef_version}/distro/#{dist_dir}/etc/init.d/chef-client")
80   - conf_content = IO.read("#{node.languages.ruby.gems_dir}/gems/chef-#{chef_version}/distro/#{dist_dir}/etc/#{conf_dir}/chef-client")
81   -
82   - file "/etc/init.d/chef-client" do
83   - content init_content
84   - mode 0755
85   - end
86   -
87   - file "/etc/#{conf_dir}/chef-client" do
88   - content conf_content
89   - mode 0644
90   - end
91   -
92   - service "chef-client" do
93   - action :enable
94   - end
95   -
96   -when "bsd"
97   - log("You specified service style 'bsd'. You will need to set up your rc.local file.")
98   - log("Hint: chef-client -i #{node[:chef][:client_interval]} -s #{node[:chef][:client_splay]}")
99   -else
100   - log("Could not determine service init style, manual intervention required to start up the chef-client service.")
101   -end
  52 +include_recipe "chef::client_service"
100 chef/recipes/client_service.rb
... ... @@ -0,0 +1,100 @@
  1 +#
  2 +# Author:: Joshua Timberman <joshua@opscode.com>
  3 +# Cookbook Name:: chef
  4 +# Recipe:: bootstrap_client
  5 +#
  6 +# Copyright 2009-2010, Opscode, Inc.
  7 +#
  8 +# Licensed under the Apache License, Version 2.0 (the "License");
  9 +# you may not use this file except in compliance with the License.
  10 +# You may obtain a copy of the License at
  11 +#
  12 +# http://www.apache.org/licenses/LICENSE-2.0
  13 +#
  14 +# Unless required by applicable law or agreed to in writing, software
  15 +# distributed under the License is distributed on an "AS IS" BASIS,
  16 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17 +# See the License for the specific language governing permissions and
  18 +# limitations under the License.
  19 +#
  20 +
  21 +root_group = value_for_platform(
  22 + "openbsd" => { "default" => "wheel" },
  23 + "freebsd" => { "default" => "wheel" },
  24 + "default" => "root"
  25 +)
  26 +
  27 +case node[:chef][:init_style]
  28 +when "runit"
  29 +
  30 + include_recipe "runit"
  31 + runit_service "chef-client"
  32 +
  33 +when "init"
  34 +
  35 + directory node[:chef][:run_path] do
  36 + action :create
  37 + owner "root"
  38 + group root_group
  39 + mode "755"
  40 + end
  41 +
  42 + dist_dir = value_for_platform(
  43 + ["ubuntu", "debian"] => { "default" => "debian" },
  44 + ["redhat", "centos", "fedora"] => { "default" => "redhat"}
  45 + )
  46 +
  47 + conf_dir = value_for_platform(
  48 + ["ubuntu", "debian"] => { "default" => "default" },
  49 + ["redhat", "centos", "fedora"] => { "default" => "sysconfig"}
  50 + )
  51 +
  52 + chef_version = node.chef_packages.chef[:version]
  53 +
  54 + init_content = IO.read("#{node[:languages][:ruby][:gems_dir]}/gems/chef-#{chef_version}/distro/#{dist_dir}/etc/init.d/chef-client")
  55 + conf_content = IO.read("#{node[:languages][:ruby][:gems_dir]}/gems/chef-#{chef_version}/distro/#{dist_dir}/etc/#{conf_dir}/chef-client")
  56 +
  57 + file "/etc/init.d/chef-client" do
  58 + content init_content
  59 + mode 0755
  60 + end
  61 +
  62 + file "/etc/#{conf_dir}/chef-client" do
  63 + content conf_content
  64 + mode 0644
  65 + end
  66 +
  67 + service "chef-client" do
  68 + action :enable
  69 + end
  70 +
  71 +when "bluepill"
  72 +
  73 + include_recipe "bluepill"
  74 +
  75 + template "#{node[:bluepill][:conf_dir]}/chef-client.pill" do
  76 + source "chef-client.pill.erb"
  77 + mode 0644
  78 + end
  79 +
  80 + bluepill_service "chef-client" do
  81 + action [:enable,:load,:start]
  82 + end
  83 +
  84 +when "daemontools"
  85 +
  86 + include_recipe "daemontools"
  87 +
  88 + daemontools_service "chef-client" do
  89 + directory "/etc/sv/chef-client"
  90 + template "chef-client"
  91 + action [:enable,:start]
  92 + log true
  93 + end
  94 +
  95 +when "bsd"
  96 + log("You specified service style 'bsd'. You will need to set up your rc.local file.")
  97 + log("Hint: chef-client -i #{node[:chef][:client_interval]} -s #{node[:chef][:client_splay]}")
  98 +else
  99 + log("Could not determine service init style, manual intervention required to start up the chef-client service.")
  100 +end
13 chef/templates/default/chef-client.pill.erb
... ... @@ -0,0 +1,13 @@
  1 +Bluepill.application("chef-client") do |app|
  2 +
  3 + app.process("chef-client") do |process|
  4 + process.pid_file = "<%= node[:chef[:run_path] %>/chef-client.pid"
  5 + process.working_dir = "<%= node[:chef][:path] %>"
  6 + process.start_command = "env PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin<% if node[:languages][:ruby][:gems_dir] %>:<%= node[:languages][:ruby][:gems_dir] %>/bin<% end -%> chef-client -i <%= node[:chef][:client_interval] %> -s <%= node[:chef][:client_splay] %>"
  7 + process.stdout = process.stderr = "<%= node[:chef][:log_dir] %>/client.log"
  8 + process.start_grace_time = 5.seconds
  9 + process.stop_grace_time = 5.seconds
  10 + process.restart_grace_time = 30.seconds
  11 + end
  12 +
  13 +end

0 comments on commit 3c255b6

Please sign in to comment.
Something went wrong with that request. Please try again.