from-scratch 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +2 -1
  3. data/Berksfile.lock +20 -1
  4. data/cookbooks/bluepill/CHANGELOG.md +93 -0
  5. data/cookbooks/bluepill/README.md +91 -0
  6. data/cookbooks/bluepill/attributes/default.rb +44 -0
  7. data/cookbooks/bluepill/metadata.json +1 -0
  8. data/cookbooks/bluepill/providers/service.rb +172 -0
  9. data/cookbooks/bluepill/recipes/default.rb +48 -0
  10. data/cookbooks/bluepill/recipes/rsyslog.rb +28 -0
  11. data/cookbooks/bluepill/resources/service.rb +27 -0
  12. data/cookbooks/bluepill/templates/default/bluepill_init.fedora.erb +34 -0
  13. data/cookbooks/bluepill/templates/default/bluepill_init.freebsd.erb +32 -0
  14. data/cookbooks/bluepill/templates/default/bluepill_init.lsb.erb +37 -0
  15. data/cookbooks/bluepill/templates/default/bluepill_init.rhel.erb +34 -0
  16. data/cookbooks/bluepill/templates/default/bluepill_rsyslog.conf.erb +1 -0
  17. data/cookbooks/nginx/CHANGELOG.md +435 -0
  18. data/cookbooks/nginx/README.md +521 -0
  19. data/cookbooks/nginx/attributes/auth_request.rb +23 -0
  20. data/cookbooks/nginx/attributes/default.rb +131 -0
  21. data/cookbooks/nginx/attributes/devel.rb +24 -0
  22. data/cookbooks/nginx/attributes/echo.rb +24 -0
  23. data/cookbooks/nginx/attributes/geoip.rb +31 -0
  24. data/cookbooks/nginx/attributes/headers_more.rb +24 -0
  25. data/cookbooks/nginx/attributes/lua.rb +28 -0
  26. data/cookbooks/nginx/attributes/naxsi.rb +24 -0
  27. data/cookbooks/nginx/attributes/openssl_source.rb +23 -0
  28. data/cookbooks/nginx/attributes/pagespeed.rb +9 -0
  29. data/cookbooks/nginx/attributes/passenger.rb +58 -0
  30. data/cookbooks/nginx/attributes/rate_limiting.rb +23 -0
  31. data/cookbooks/nginx/attributes/repo.rb +35 -0
  32. data/cookbooks/nginx/attributes/set_misc.rb +8 -0
  33. data/cookbooks/nginx/attributes/socketproxy.rb +13 -0
  34. data/cookbooks/nginx/attributes/source.rb +42 -0
  35. data/cookbooks/nginx/attributes/status.rb +22 -0
  36. data/cookbooks/nginx/attributes/syslog.rb +24 -0
  37. data/cookbooks/nginx/attributes/upload_progress.rb +26 -0
  38. data/cookbooks/nginx/definitions/nginx_site.rb +50 -0
  39. data/cookbooks/nginx/files/default/mime.types +78 -0
  40. data/cookbooks/nginx/files/default/naxsi_core.rules +82 -0
  41. data/cookbooks/nginx/libraries/matchers.rb +20 -0
  42. data/cookbooks/nginx/metadata.json +351 -0
  43. data/cookbooks/nginx/recipes/authorized_ips.rb +32 -0
  44. data/cookbooks/nginx/recipes/commons.rb +24 -0
  45. data/cookbooks/nginx/recipes/commons_conf.rb +42 -0
  46. data/cookbooks/nginx/recipes/commons_dir.rb +57 -0
  47. data/cookbooks/nginx/recipes/commons_script.rb +29 -0
  48. data/cookbooks/nginx/recipes/default.rb +31 -0
  49. data/cookbooks/nginx/recipes/headers_more_module.rb +50 -0
  50. data/cookbooks/nginx/recipes/http_auth_request_module.rb +52 -0
  51. data/cookbooks/nginx/recipes/http_echo_module.rb +46 -0
  52. data/cookbooks/nginx/recipes/http_geoip_module.rb +113 -0
  53. data/cookbooks/nginx/recipes/http_gzip_static_module.rb +30 -0
  54. data/cookbooks/nginx/recipes/http_mp4_module.rb +2 -0
  55. data/cookbooks/nginx/recipes/http_perl_module.rb +23 -0
  56. data/cookbooks/nginx/recipes/http_realip_module.rb +38 -0
  57. data/cookbooks/nginx/recipes/http_spdy_module.rb +23 -0
  58. data/cookbooks/nginx/recipes/http_ssl_module.rb +23 -0
  59. data/cookbooks/nginx/recipes/http_stub_status_module.rb +36 -0
  60. data/cookbooks/nginx/recipes/ipv6.rb +23 -0
  61. data/cookbooks/nginx/recipes/lua.rb +47 -0
  62. data/cookbooks/nginx/recipes/naxsi_module.rb +52 -0
  63. data/cookbooks/nginx/recipes/ngx_devel_module.rb +44 -0
  64. data/cookbooks/nginx/recipes/ngx_lua_module.rb +47 -0
  65. data/cookbooks/nginx/recipes/ohai_plugin.rb +35 -0
  66. data/cookbooks/nginx/recipes/openssl_source.rb +45 -0
  67. data/cookbooks/nginx/recipes/package.rb +52 -0
  68. data/cookbooks/nginx/recipes/pagespeed_module.rb +62 -0
  69. data/cookbooks/nginx/recipes/passenger.rb +56 -0
  70. data/cookbooks/nginx/recipes/repo.rb +41 -0
  71. data/cookbooks/nginx/recipes/repo_passenger.rb +39 -0
  72. data/cookbooks/nginx/recipes/set_misc.rb +30 -0
  73. data/cookbooks/nginx/recipes/socketproxy.rb +26 -0
  74. data/cookbooks/nginx/recipes/source.rb +205 -0
  75. data/cookbooks/nginx/recipes/syslog_module.rb +69 -0
  76. data/cookbooks/nginx/recipes/upload_progress_module.rb +53 -0
  77. data/cookbooks/nginx/templates/debian/nginx.init.erb +97 -0
  78. data/cookbooks/nginx/templates/default/default-site.erb +11 -0
  79. data/cookbooks/nginx/templates/default/modules/authorized_ip.erb +6 -0
  80. data/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb +4 -0
  81. data/cookbooks/nginx/templates/default/modules/http_gzip_static.conf.erb +1 -0
  82. data/cookbooks/nginx/templates/default/modules/http_realip.conf.erb +7 -0
  83. data/cookbooks/nginx/templates/default/modules/nginx_status.erb +14 -0
  84. data/cookbooks/nginx/templates/default/modules/passenger.conf.erb +13 -0
  85. data/cookbooks/nginx/templates/default/modules/socketproxy.conf.erb +89 -0
  86. data/cookbooks/nginx/templates/default/modules/upload_progress.erb +4 -0
  87. data/cookbooks/nginx/templates/default/nginx-upstart.conf.erb +39 -0
  88. data/cookbooks/nginx/templates/default/nginx.conf.erb +103 -0
  89. data/cookbooks/nginx/templates/default/nginx.init.erb +111 -0
  90. data/cookbooks/nginx/templates/default/nginx.pill.erb +15 -0
  91. data/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
  92. data/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  93. data/cookbooks/nginx/templates/default/nxensite.erb +38 -0
  94. data/cookbooks/nginx/templates/default/plugins/nginx.rb.erb +66 -0
  95. data/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
  96. data/cookbooks/nginx/templates/default/sv-nginx-run.erb +4 -0
  97. data/cookbooks/nginx/templates/gentoo/nginx.init.erb +87 -0
  98. data/cookbooks/nginx/templates/suse/nginx.init.erb +115 -0
  99. data/cookbooks/nginx/templates/ubuntu/nginx.init.erb +97 -0
  100. data/cookbooks/ohai/CHANGELOG.md +69 -0
  101. data/cookbooks/ohai/README.md +89 -0
  102. data/cookbooks/ohai/attributes/default.rb +31 -0
  103. data/cookbooks/ohai/files/default/plugins/README +1 -0
  104. data/cookbooks/ohai/libraries/matchers.rb +14 -0
  105. data/cookbooks/ohai/metadata.json +1 -0
  106. data/cookbooks/ohai/providers/hint.rb +38 -0
  107. data/cookbooks/ohai/recipes/default.rb +52 -0
  108. data/cookbooks/ohai/resources/hint.rb +5 -0
  109. data/cookbooks/packagecloud/CHANGELOG.md +12 -0
  110. data/cookbooks/packagecloud/README.md +80 -0
  111. data/cookbooks/packagecloud/attributes/default.rb +8 -0
  112. data/cookbooks/packagecloud/libraries/helper.rb +43 -0
  113. data/cookbooks/packagecloud/libraries/matcher.rb +7 -0
  114. data/cookbooks/packagecloud/metadata.json +1 -0
  115. data/cookbooks/packagecloud/providers/repo.rb +212 -0
  116. data/cookbooks/packagecloud/resources/repo.rb +10 -0
  117. data/cookbooks/packagecloud/templates/.kitchen/logs/kitchen.log +29 -0
  118. data/cookbooks/packagecloud/templates/default/apt.erb +2 -0
  119. data/cookbooks/packagecloud/templates/default/yum.erb +15 -0
  120. data/cookbooks/rsyslog/CHANGELOG.md +193 -0
  121. data/cookbooks/rsyslog/README.md +276 -0
  122. data/cookbooks/rsyslog/attributes/default.rb +131 -0
  123. data/cookbooks/rsyslog/libraries/helpers.rb +25 -0
  124. data/cookbooks/rsyslog/metadata.json +1 -0
  125. data/cookbooks/rsyslog/providers/file_input.rb +44 -0
  126. data/cookbooks/rsyslog/recipes/client.rb +87 -0
  127. data/cookbooks/rsyslog/recipes/default.rb +89 -0
  128. data/cookbooks/rsyslog/recipes/server.rb +44 -0
  129. data/cookbooks/rsyslog/resources/file_input.rb +28 -0
  130. data/cookbooks/rsyslog/templates/default/35-server-per-host.conf.erb +62 -0
  131. data/cookbooks/rsyslog/templates/default/49-relp.conf.erb +10 -0
  132. data/cookbooks/rsyslog/templates/default/49-remote.conf.erb +30 -0
  133. data/cookbooks/rsyslog/templates/default/50-default.conf.erb +6 -0
  134. data/cookbooks/rsyslog/templates/default/file-input.conf.erb +15 -0
  135. data/cookbooks/rsyslog/templates/default/omnios-manifest.xml.erb +30 -0
  136. data/cookbooks/rsyslog/templates/default/rsyslog.conf.erb +117 -0
  137. data/cookbooks/rsyslog/templates/smartos/50-default.conf.erb +18 -0
  138. data/cookbooks/runit/.kitchen.cloud.yml +103 -0
  139. data/cookbooks/runit/.kitchen.yml +38 -0
  140. data/cookbooks/runit/.rspec +3 -0
  141. data/cookbooks/runit/.rubocop.yml +45 -0
  142. data/cookbooks/runit/Berksfile.disabled +11 -0
  143. data/cookbooks/runit/CHANGELOG.md +226 -0
  144. data/cookbooks/runit/CONTRIBUTING.md +266 -0
  145. data/cookbooks/runit/Cheffile +11 -0
  146. data/cookbooks/runit/Gemfile +17 -0
  147. data/cookbooks/runit/LICENSE +201 -0
  148. data/cookbooks/runit/README.md +435 -0
  149. data/cookbooks/runit/Rakefile +23 -0
  150. data/cookbooks/runit/TESTING.md +26 -0
  151. data/cookbooks/runit/attributes/default.rb +62 -0
  152. data/cookbooks/runit/files/default/runit.seed +1 -0
  153. data/cookbooks/runit/files/default/runsvdir +0 -0
  154. data/cookbooks/runit/files/ubuntu-6.10/runsvdir +6 -0
  155. data/cookbooks/runit/files/ubuntu-7.04/runsvdir +7 -0
  156. data/cookbooks/runit/files/ubuntu-7.10/runsvdir +7 -0
  157. data/cookbooks/runit/files/ubuntu-8.04/runsvdir +7 -0
  158. data/cookbooks/runit/libraries/default.rb +0 -0
  159. data/cookbooks/runit/libraries/helpers.rb +190 -0
  160. data/cookbooks/runit/libraries/matchers.rb +69 -0
  161. data/cookbooks/runit/libraries/provider_runit_service.rb +326 -0
  162. data/cookbooks/runit/libraries/resource_runit_service.rb +267 -0
  163. data/cookbooks/runit/metadata.json +50 -0
  164. data/cookbooks/runit/recipes/default.rb +91 -0
  165. data/cookbooks/runit/templates/debian/init.d.erb +66 -0
  166. data/cookbooks/runit/templates/default/log-config.erb +24 -0
  167. data/cookbooks/runit/templates/gentoo/runit-start.sh.erb +32 -0
  168. data/cookbooks/scratchify/Berksfile +2 -1
  169. data/cookbooks/scratchify/Berksfile.lock +20 -1
  170. data/cookbooks/scratchify/lib/from-scratch.rb +1 -4
  171. data/cookbooks/scratchify/lib/from-scratch/version.rb +1 -1
  172. data/cookbooks/scratchify/metadata.json +5 -2
  173. data/cookbooks/scratchify/recipes/default.rb +15 -1
  174. data/cookbooks/scratchify/recipes/nginx_site.rb +4 -0
  175. data/cookbooks/scratchify/recipes/pre_rvm.rb +5 -0
  176. data/cookbooks/scratchify/templates/nginx.erb +31 -0
  177. data/cookbooks/scratchify/templates/node.json.erb +21 -6
  178. data/cookbooks/yum-epel/CHANGELOG.md +84 -0
  179. data/cookbooks/yum-epel/README.md +172 -0
  180. data/cookbooks/yum-epel/attributes/default.rb +1 -0
  181. data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +28 -0
  182. data/cookbooks/yum-epel/attributes/epel-source.rb +28 -0
  183. data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +28 -0
  184. data/cookbooks/yum-epel/attributes/epel-testing-source.rb +28 -0
  185. data/cookbooks/yum-epel/attributes/epel-testing.rb +28 -0
  186. data/cookbooks/yum-epel/attributes/epel.rb +28 -0
  187. data/cookbooks/yum-epel/metadata.json +1 -0
  188. data/cookbooks/yum-epel/recipes/default.rb +61 -0
  189. data/cookbooks/yum/CHANGELOG.md +294 -0
  190. data/cookbooks/yum/README.md +285 -0
  191. data/cookbooks/yum/attributes/main.rb +100 -0
  192. data/cookbooks/yum/libraries/matchers.rb +27 -0
  193. data/cookbooks/yum/metadata.json +1 -0
  194. data/cookbooks/yum/providers/globalconfig.rb +41 -0
  195. data/cookbooks/yum/providers/repository.rb +106 -0
  196. data/cookbooks/yum/recipes/default.rb +26 -0
  197. data/cookbooks/yum/resources/globalconfig.rb +109 -0
  198. data/cookbooks/yum/resources/repository.rb +69 -0
  199. data/cookbooks/yum/templates/default/main.erb +276 -0
  200. data/cookbooks/yum/templates/default/repo.erb +125 -0
  201. data/lib/from-scratch.rb +1 -0
  202. data/lib/from-scratch/version.rb +1 -1
  203. data/metadata.rb +5 -1
  204. data/recipes/default.rb +15 -1
  205. data/recipes/nginx_site.rb +4 -0
  206. data/recipes/pre_rvm.rb +5 -0
  207. data/templates/nginx.erb +31 -0
  208. data/templates/node.json.erb +21 -6
  209. metadata +194 -1
@@ -0,0 +1,97 @@
1
+ #!/bin/sh
2
+
3
+ ### BEGIN INIT INFO
4
+ # Provides: nginx
5
+ # Required-Start: $local_fs $remote_fs $network $syslog
6
+ # Required-Stop: $local_fs $remote_fs $network $syslog
7
+ # Default-Start: 2 3 4 5
8
+ # Default-Stop: 0 1 6
9
+ # Short-Description: starts the nginx web server
10
+ # Description: starts nginx using start-stop-daemon
11
+ ### END INIT INFO
12
+
13
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
14
+ DAEMON=<%= node['nginx']['binary'] %>
15
+ NAME=nginx
16
+ DESC=nginx
17
+ PID=<%= node['nginx']['pid'] %>
18
+
19
+ # Include nginx defaults if available
20
+ if [ -f /etc/default/nginx ]; then
21
+ . /etc/default/nginx
22
+ fi
23
+
24
+ test -x $DAEMON || exit 0
25
+
26
+ set -e
27
+
28
+ . /lib/lsb/init-functions
29
+
30
+ test_nginx_config() {
31
+ if $DAEMON -t $DAEMON_OPTS >/dev/null 2>&1; then
32
+ return 0
33
+ else
34
+ $DAEMON -t $DAEMON_OPTS
35
+ return $?
36
+ fi
37
+ }
38
+
39
+ case "$1" in
40
+ start)
41
+ echo -n "Starting $DESC: "
42
+ test_nginx_config
43
+ # Check if the ULIMIT is set in /etc/default/nginx
44
+ if [ -n "$ULIMIT" ]; then
45
+ # Set the ulimits
46
+ ulimit $ULIMIT
47
+ fi
48
+ start-stop-daemon --start --quiet --pidfile $PID \
49
+ --exec $DAEMON -- $DAEMON_OPTS || true
50
+ echo "$NAME."
51
+ ;;
52
+
53
+ stop)
54
+ echo -n "Stopping $DESC: "
55
+ start-stop-daemon --stop --quiet --pidfile $PID \
56
+ --exec $DAEMON || true
57
+ echo "$NAME."
58
+ ;;
59
+
60
+ restart|force-reload)
61
+ echo -n "Restarting $DESC: "
62
+ start-stop-daemon --stop --quiet --pidfile \
63
+ $PID --exec $DAEMON || true
64
+ sleep 1
65
+ test_nginx_config
66
+ start-stop-daemon --start --quiet --pidfile \
67
+ $PID --exec $DAEMON -- $DAEMON_OPTS || true
68
+ echo "$NAME."
69
+ ;;
70
+
71
+ reload)
72
+ echo -n "Reloading $DESC configuration: "
73
+ test_nginx_config
74
+ start-stop-daemon --stop --signal HUP --quiet --pidfile $PID \
75
+ --exec $DAEMON || true
76
+ echo "$NAME."
77
+ ;;
78
+
79
+ configtest|testconfig)
80
+ echo -n "Testing $DESC configuration: "
81
+ if test_nginx_config; then
82
+ echo "$NAME."
83
+ else
84
+ exit $?
85
+ fi
86
+ ;;
87
+
88
+ status)
89
+ status_of_proc -p $PID "$DAEMON" nginx && exit 0 || exit $?
90
+ ;;
91
+ *)
92
+ echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" >&2
93
+ exit 1
94
+ ;;
95
+ esac
96
+
97
+ exit 0
@@ -0,0 +1,69 @@
1
+ ohai Cookbook CHANGELOG
2
+ =======================
3
+ This file is used to list changes made in each version of the ohai cookbook.
4
+
5
+ v2.0.3 (2015-10-21)
6
+ -------------------
7
+ * Validate the hints before loading them to avoid failures
8
+ * Added supported platforms to the metadata
9
+ * Updated .gitignore file
10
+ * Updated Test Kitchen config for the latest platforms
11
+ * Added Chef standard Rubocop config
12
+ * Added Travis CI testing
13
+ * Added Berksfile
14
+ * Updated contributing and testing docs
15
+ * Added maintainers.md and maintainers.toml files
16
+ * Added Travis and cookbook version badges to the readme
17
+ * Expanded the requirements section in the readme and clarify the minimum supported Chef release is 11
18
+ * Updated Opscode -> Chef Software
19
+ * Added a Rakefile for simplified testing
20
+ * Added a Chefignore file
21
+ * Resolved Rubocop warnings
22
+ * Added source_url and issues_url to the metadata
23
+ * Added Chefspec matchers
24
+ * Added basic convergence Chefspec test
25
+
26
+ v2.0.1 (2014-06-07)
27
+ -------------------
28
+ * [COOK-4683] Remove warnings about reopening resource
29
+
30
+ Please note, this changes the name of a remote_directory resource. It is not expected that anyone would be explicitly notifying this resource but, please review [PR #16](https://github.com/chef-cookbooks/ohai/pull/16/files) for more info.
31
+
32
+ v2.0.0 (2014-02-25)
33
+ -------------------
34
+ '[COOK-3865] - create lwrp ohai_hint'
35
+
36
+ v1.1.12
37
+ -------
38
+ - Dummy release due to a Community Site upload failure
39
+
40
+ v1.1.10
41
+ -------
42
+ ### Bug
43
+ - **[COOK-3091](https://tickets.chef.io/browse/COOK-3091)** - Fix checking `Chef::Config[:config_file]`
44
+
45
+ v1.1.8
46
+ ------
47
+ - [COOK-1918] - Ohai cookbook to distribute plugins fails on windows
48
+ - [COOK-2096] - Ohai cookbook sets unix-only default path attribute
49
+
50
+ v1.1.6
51
+ ------
52
+ - [COOK-2057] - distribution from another cookbok fails if ohai attributes are loaded after the other cookbook
53
+
54
+ v1.1.4
55
+ ------
56
+ - [COOK-1128] - readme update, Replace reference to deprecated chef cookbook with one to chef-client
57
+
58
+ v1.1.2
59
+ ------
60
+ - [COOK-1424] - prevent plugin_path growth to infinity
61
+
62
+ v1.1.0
63
+ ------
64
+ - [COOK-1174] - custom_plugins is only conditionally available
65
+ - [COOK-1383] - allow plugins from other cookbooks
66
+
67
+ v1.0.2
68
+ ------
69
+ - [COOK-463] ohai cookbook default recipe should only reload plugins if there were updates
@@ -0,0 +1,89 @@
1
+ ohai Cookbook
2
+ =============
3
+ [![Build Status](https://travis-ci.org/chef-cookbooks/ohai.svg?branch=master)](http://travis-ci.org/chef-cookbooks/ohai)
4
+ [![Cookbook Version](https://img.shields.io/cookbook/v/ohai.svg)](https://supermarket.chef.io/cookbooks/ohai)
5
+
6
+ Creates a configured plugin path for distributing custom Ohai plugins, and reloads them via Ohai within the context of a Chef Client run during the compile phase (if needed).
7
+
8
+
9
+ Requirements
10
+ ------------
11
+ #### Platforms
12
+ - Debian/Ubuntu
13
+ - RHEL/CentOS/Scientific/Amazon/Oracle
14
+ - Windows
15
+
16
+ #### Chef
17
+ - Chef 11+
18
+
19
+ #### Cookbooks
20
+ - none
21
+
22
+ Attributes
23
+ ----------
24
+ - `node['ohai']['plugin_path']` - location to drop off plugins directory, default is `/etc/chef/ohai_plugins`. This is not FHS-compliant, an FHS location would be something like `/var/lib/ohai/plugins`, or `/var/lib/chef/ohai_plugins` or similar.
25
+
26
+ Neither an FHS location or the default value of this attribute are in the default Ohai plugin path. Set the Ohai plugin path with the config setting "`Ohai::Config[:plugin_path]`" in the Chef config file (the `chef-client::config` recipe does this automatically for you!). The attribute is not set to the default plugin path that Ohai ships with because we don't want to risk destroying existing essential plugins for Ohai.
27
+
28
+ - `node['ohai']['plugins']` - sources of plugins, defaults to the `files/default/plugins` directory of this cookbook. You can add additional cookbooks by adding the name of the cookbook as a key and the path of the files directory as the value. You have to make sure that you don't have any file conflicts between multiple cookbooks. The last one to write wins.
29
+
30
+ - `node['ohai']['hints_path']` - location to drop off hints directory, default is `/etc/chef/ohai/hints`.
31
+
32
+ Usage
33
+ -----
34
+ Put the recipe `ohai` at the start of the node's run list to make sure that custom plugins are loaded early on in the Chef run and data is available for later recipes.
35
+
36
+ The execution of the custom plugins occurs within the recipe during the compile phase, so you can write new plugins and use the data they return in your Chef recipes.
37
+
38
+ For information on how to write custom plugins for Ohai, please see the Chef wiki pages.
39
+
40
+ http://wiki.chef.io/display/chef/Writing+Ohai+Plugins
41
+
42
+ *PLEASE NOTE* - This recipe reloads the Ohai plugins a 2nd time during the Chef run if:
43
+
44
+ * The "`Ohai::Config[:plugin_path]`" config setting has *NOT* been properly set in the Chef config file
45
+ - The "`Ohai::Config[:plugin_path]`" config setting has been properly set in the Chef config file and there are updated plugins dropped off at "`node['ohai']['plugin_path']`".
46
+
47
+ LWRP
48
+ ----
49
+
50
+ ### `ohai_hint`
51
+
52
+ Create hints file. You can find usage examples at `test/cookbooks/ohai_test/recipes/*.rb`.
53
+
54
+ #### Resource Attributes
55
+
56
+ - `hint_name` - The name of hints file and key. Should be string, default is name of resource.
57
+ - `content` - Values of hints. It will be used as automatic attributes. Should be Hash, default is empty Hash class.
58
+
59
+ #### ChefSpec Matchers
60
+
61
+ You can check for the creation or deletion of ohai hints with chefspec using these custom matches:
62
+
63
+ - create_ohai_hint
64
+ - delete_ohai_hint
65
+
66
+ Example
67
+ -------
68
+ For an example implementation, inspect the ohai_plugin.rb recipe in the nginx community cookbook.
69
+
70
+
71
+ License & Authors
72
+ -----------------
73
+
74
+ **Author:** Cookbook Engineering Team (<cookbooks@chef.io>)
75
+
76
+ **Copyright:** 2011-2015, Chef Software, Inc.
77
+ ```
78
+ Licensed under the Apache License, Version 2.0 (the "License");
79
+ you may not use this file except in compliance with the License.
80
+ You may obtain a copy of the License at
81
+
82
+ http://www.apache.org/licenses/LICENSE-2.0
83
+
84
+ Unless required by applicable law or agreed to in writing, software
85
+ distributed under the License is distributed on an "AS IS" BASIS,
86
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
87
+ See the License for the specific language governing permissions and
88
+ limitations under the License.
89
+ ```
@@ -0,0 +1,31 @@
1
+ #
2
+ # Cookbook Name:: ohai
3
+ # Attribute:: default
4
+ #
5
+ # Copyright 2010-2015, Chef Software, Inc
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ # FHS location would be /var/lib/chef/ohai_plugins or similar.
21
+ case node['platform_family']
22
+ when 'windows'
23
+ default['ohai']['plugin_path'] = 'C:/chef/ohai_plugins'
24
+ default['ohai']['hints_path'] = 'C:/chef/ohai/hints'
25
+ else
26
+ default['ohai']['plugin_path'] = '/etc/chef/ohai_plugins'
27
+ default['ohai']['hints_path'] = '/etc/chef/ohai/hints'
28
+ end
29
+
30
+ # The list of plugins and their respective file locations
31
+ default['ohai']['plugins']['ohai'] = 'plugins'
@@ -0,0 +1 @@
1
+ This directory contains custom plugins for Ohai.
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ if defined?(ChefSpec)
4
+ ChefSpec::Runner.define_runner_method(:ohai_hint)
5
+
6
+ def create_ohai_hint(resource)
7
+ ChefSpec::Matchers::ResourceMatcher.new(:ohai_hint, :create, resource)
8
+ end
9
+
10
+ def delete_ohai_hint(resource)
11
+ ChefSpec::Matchers::ResourceMatcher.new(:ohai_hint, :delete, resource)
12
+ end
13
+
14
+ end
@@ -0,0 +1 @@
1
+ {"name":"ohai","version":"2.0.3","description":"Distributes a directory of custom ohai plugins","long_description":"ohai Cookbook\n=============\n[![Build Status](https://travis-ci.org/chef-cookbooks/ohai.svg?branch=master)](http://travis-ci.org/chef-cookbooks/ohai)\n[![Cookbook Version](https://img.shields.io/cookbook/v/ohai.svg)](https://supermarket.chef.io/cookbooks/ohai)\n\nCreates a configured plugin path for distributing custom Ohai plugins, and reloads them via Ohai within the context of a Chef Client run during the compile phase (if needed).\n\n\nRequirements\n------------\n#### Platforms\n- Debian/Ubuntu\n- RHEL/CentOS/Scientific/Amazon/Oracle\n- Windows\n\n#### Chef\n- Chef 11+\n\n#### Cookbooks\n- none\n\nAttributes\n----------\n- `node['ohai']['plugin_path']` - location to drop off plugins directory, default is `/etc/chef/ohai_plugins`. This is not FHS-compliant, an FHS location would be something like `/var/lib/ohai/plugins`, or `/var/lib/chef/ohai_plugins` or similar.\n\n Neither an FHS location or the default value of this attribute are in the default Ohai plugin path. Set the Ohai plugin path with the config setting \"`Ohai::Config[:plugin_path]`\" in the Chef config file (the `chef-client::config` recipe does this automatically for you!). The attribute is not set to the default plugin path that Ohai ships with because we don't want to risk destroying existing essential plugins for Ohai.\n\n- `node['ohai']['plugins']` - sources of plugins, defaults to the `files/default/plugins` directory of this cookbook. You can add additional cookbooks by adding the name of the cookbook as a key and the path of the files directory as the value. You have to make sure that you don't have any file conflicts between multiple cookbooks. The last one to write wins.\n\n- `node['ohai']['hints_path']` - location to drop off hints directory, default is `/etc/chef/ohai/hints`.\n\nUsage\n-----\nPut the recipe `ohai` at the start of the node's run list to make sure that custom plugins are loaded early on in the Chef run and data is available for later recipes.\n\nThe execution of the custom plugins occurs within the recipe during the compile phase, so you can write new plugins and use the data they return in your Chef recipes.\n\nFor information on how to write custom plugins for Ohai, please see the Chef wiki pages.\n\nhttp://wiki.chef.io/display/chef/Writing+Ohai+Plugins\n\n*PLEASE NOTE* - This recipe reloads the Ohai plugins a 2nd time during the Chef run if:\n\n* The \"`Ohai::Config[:plugin_path]`\" config setting has *NOT* been properly set in the Chef config file\n- The \"`Ohai::Config[:plugin_path]`\" config setting has been properly set in the Chef config file and there are updated plugins dropped off at \"`node['ohai']['plugin_path']`\".\n\nLWRP\n----\n\n### `ohai_hint`\n\nCreate hints file. You can find usage examples at `test/cookbooks/ohai_test/recipes/*.rb`.\n\n#### Resource Attributes\n\n - `hint_name` - The name of hints file and key. Should be string, default is name of resource.\n - `content` - Values of hints. It will be used as automatic attributes. Should be Hash, default is empty Hash class.\n\n#### ChefSpec Matchers\n\nYou can check for the creation or deletion of ohai hints with chefspec using these custom matches:\n\n - create_ohai_hint\n - delete_ohai_hint\n\nExample\n-------\nFor an example implementation, inspect the ohai_plugin.rb recipe in the nginx community cookbook.\n\n\nLicense & Authors\n-----------------\n\n**Author:** Cookbook Engineering Team (<cookbooks@chef.io>)\n\n**Copyright:** 2011-2015, Chef Software, Inc.\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\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache 2.0","platforms":{"ubuntu":">= 0.0.0","debian":">= 0.0.0","centos":">= 0.0.0","redhat":">= 0.0.0","amazon":">= 0.0.0","scientific":">= 0.0.0","fedora":">= 0.0.0","oracle":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{"ohai/plugin_path":{"display_name":"Ohai Plugin Path","description":"Distribute plugins to this path.","type":"string","required":"optional","default":"/etc/chef/ohai_plugins"},"ohai/plugins":{"display_name":"Ohai Plugin Sources","description":"Read plugins from these cookbooks and paths","type":"hash","required":"optional","default":{"ohai":"plugins"}}},"groupings":{},"recipes":{"ohai::default":"Distributes a directory of custom ohai plugins"}}
@@ -0,0 +1,38 @@
1
+ def why_run_supported?
2
+ true
3
+ end
4
+
5
+ def build_ohai_hint_path
6
+ ::File.join(node['ohai']['hints_path'], "#{new_resource.name}.json")
7
+ end
8
+
9
+ use_inline_resources
10
+
11
+ action :create do
12
+ if @current_resource.content != new_resource.content
13
+ directory node['ohai']['hints_path'] do
14
+ action :create
15
+ recursive true
16
+ end
17
+
18
+ file build_ohai_hint_path do
19
+ action :create
20
+ content JSON.pretty_generate(new_resource.content)
21
+ end
22
+ end
23
+ end
24
+
25
+ def load_current_resource
26
+ @current_resource = Chef::Resource::OhaiHint.new(new_resource.name)
27
+ if ::File.exist?(build_ohai_hint_path)
28
+ begin
29
+ @current_resource.content(JSON.parse(::File.read(build_ohai_hint_path)))
30
+ rescue JSON::ParserError
31
+ @current_resource.content(nil)
32
+ end
33
+ else
34
+ @current_resource.content(nil)
35
+ end
36
+
37
+ @current_resource
38
+ end
@@ -0,0 +1,52 @@
1
+ #
2
+ # Cookbook Name:: ohai
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2011-2015, Chef Software, Inc
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ reload_ohai = false
21
+ # Add plugin_path from node attributes if missing, and ensure a reload of
22
+ # ohai in that case
23
+ unless Ohai::Config[:plugin_path].include?(node['ohai']['plugin_path'])
24
+ Ohai::Config[:plugin_path] = [node['ohai']['plugin_path'], Ohai::Config[:plugin_path]].flatten.compact
25
+ reload_ohai ||= true
26
+ end
27
+ Chef::Log.info("ohai plugins will be at: #{node['ohai']['plugin_path']}")
28
+
29
+ # This is done during the compile phase so new plugins can be used in
30
+ # resources later in the run.
31
+ node['ohai']['plugins'].each_pair do |source_cookbook, path|
32
+ rd = remote_directory "#{node['ohai']['plugin_path']} for cookbook #{source_cookbook}" do
33
+ path node['ohai']['plugin_path']
34
+ cookbook source_cookbook
35
+ source path
36
+ mode '0755' unless platform_family?('windows')
37
+ recursive true
38
+ purge false
39
+ action :nothing
40
+ end
41
+
42
+ rd.run_action(:create)
43
+ reload_ohai ||= rd.updated?
44
+ end
45
+
46
+ resource = ohai 'custom_plugins' do
47
+ action :nothing
48
+ end
49
+
50
+ # Reload ohai if the client's plugin_path did not contain
51
+ # node['ohai']['plugin_path'], or new plugins were loaded
52
+ resource.run_action(:reload) if reload_ohai
@@ -0,0 +1,5 @@
1
+ actions :create, :delete
2
+ default_action :create
3
+
4
+ attribute :hint_name, kind_of: String, name_attribute: true
5
+ attribute :content, kind_of: Hash, default: {}
@@ -0,0 +1,12 @@
1
+ packagecloud
2
+ ===============
3
+ This is the Changelog for the packagecloud cookbook
4
+
5
+ v0.0.1 (2014-06-05)
6
+ -------------------
7
+ Initial release.
8
+
9
+
10
+ v0.0.1 (2014-06-05)
11
+ -------------------
12
+ Initial release!
@@ -0,0 +1,80 @@
1
+ # packagecloud cookbook
2
+
3
+ This cookbook provides an LWRP for installing https://packagecloud.io repositories.
4
+
5
+ NOTE: Please see the Changelog below for important changes if upgrading from 0.0.19 to 0.1.0.
6
+
7
+ ## Usage
8
+
9
+ Be sure to depend on `packagecloud` in `metadata.rb` so that the packagecloud
10
+ resource will be loaded.
11
+
12
+ For public repos:
13
+
14
+ ```ruby
15
+ packagecloud_repo "computology/packagecloud-cookbook-test-public" do
16
+ type "deb"
17
+ end
18
+ ```
19
+
20
+ For private repos, you need to supply a `master_token`:
21
+
22
+ ```ruby
23
+ packagecloud_repo "computology/packagecloud-cookbook-test-private" do
24
+ type "deb"
25
+ master_token "762748f7ae0bfdb086dd539575bdc8cffdca78c6a9af0db9"
26
+ end
27
+ ```
28
+
29
+ For packagecloud:enterprise users, add `base_url` to your resource:
30
+
31
+ ```
32
+ packagecloud_repo "computology/packagecloud-cookbook-test-private" do
33
+ base_url "https://packages.example.com"
34
+ type "deb"
35
+ master_token "762748f7ae0bfdb086dd539575bdc8cffdca78c6a9af0db9"
36
+ end
37
+ ```
38
+
39
+ Valid options for `type` include `deb`, `rpm`, and `gem`.
40
+
41
+ ## Interactions with other cookbooks
42
+
43
+ On CentOS 5, the official chef yum cookbook overwrites the file
44
+ `/etc/yum.conf` setting some default values. When it does this, the `cachedir`
45
+ value is changed from the CentOS5 default to the default value in the
46
+ cookbook. The result of this change is that any packagecloud repository
47
+ installed *before* a repository installed with the yum cookbook will appear as
48
+ though it's gpg keys were not imported.
49
+
50
+ There are a few potential workarounds for this:
51
+
52
+ - Pass the "-y" flag to package resource using the `options` attribute. This
53
+ should cause yum to import the GPG key automatically if it was not imported
54
+ already.
55
+ - Move your packagecloud repos so that they are installed last, after any/all
56
+ repos installed via the yum cookbook.
57
+ - Set the cachedir option in the chef yum cookbook to the system default value
58
+ of `/var/cache/yum` using the `yum_globalconfig` resource.
59
+
60
+ CentOS 6 and 7 are not affected as the default `cachedir` value provided by
61
+ the yum chef cookbook is set to the system default, unless you use the
62
+ `yum_globalconfig` resource to set a custom cachedir. If you do set a custom
63
+ `cachedir`, you should make sure to setup packagecloud repos after that
64
+ resource is set so that the GPG keys end up in the right place.
65
+
66
+ ## Changelog
67
+
68
+ packagecloud cookbook versions 0.0.19 used an attribute called
69
+ `default['packagecloud']['hostname']` for caching the local machine's hostname
70
+ to avoid regenerating read tokens.
71
+
72
+ This attribute has been removed as it is confusing and in some edge cases,
73
+ buggy.
74
+
75
+ Beginning in 0.1.0, you can use
76
+ `default['packagecloud']['hostname_override']` to specify a hostname if ohai
77
+ is unable to determine the hostname of the node on its own.
78
+
79
+ ## Credits
80
+ Computology, LLC.