vagrant-clone 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. checksums.yaml +4 -4
  2. data/.idea/.rakeTasks +7 -0
  3. data/.idea/inspectionProfiles/Project_Default.xml +6 -0
  4. data/.idea/misc.xml +4 -0
  5. data/.idea/modules.xml +8 -0
  6. data/.idea/runConfigurations/clone.xml +21 -0
  7. data/.idea/runConfigurations/libvirt.xml +21 -0
  8. data/.idea/vagrant-clone.iml +114 -0
  9. data/.idea/vcs.xml +6 -0
  10. data/.idea/workspace.xml +948 -0
  11. data/Gemfile +9 -3
  12. data/Gemfile.lock +123 -37
  13. data/Rakefile +2 -1
  14. data/Vagrantfile +9 -0
  15. data/cookbooks/apt/CHANGELOG.md +321 -0
  16. data/cookbooks/apt/CONTRIBUTING.md +2 -0
  17. data/cookbooks/apt/MAINTAINERS.md +15 -0
  18. data/cookbooks/apt/README.md +250 -0
  19. data/cookbooks/apt/attributes/default.rb +57 -0
  20. data/cookbooks/apt/files/15update-stamp +1 -0
  21. data/cookbooks/apt/files/apt-proxy-v2.conf +50 -0
  22. data/cookbooks/apt/libraries/helpers.rb +49 -0
  23. data/cookbooks/apt/libraries/matchers.rb +16 -0
  24. data/cookbooks/apt/metadata.json +1 -0
  25. data/cookbooks/apt/recipes/cacher-client.rb +52 -0
  26. data/cookbooks/apt/recipes/cacher-ng.rb +39 -0
  27. data/cookbooks/apt/recipes/default.rb +93 -0
  28. data/cookbooks/apt/recipes/unattended-upgrades.rb +47 -0
  29. data/cookbooks/apt/resources/preference.rb +90 -0
  30. data/cookbooks/apt/templates/01proxy.erb +11 -0
  31. data/cookbooks/apt/templates/10dpkg-options.erb +8 -0
  32. data/cookbooks/apt/templates/10recommends.erb +3 -0
  33. data/cookbooks/apt/templates/20auto-upgrades.erb +5 -0
  34. data/cookbooks/apt/templates/50unattended-upgrades.erb +75 -0
  35. data/cookbooks/apt/templates/acng.conf.erb +275 -0
  36. data/cookbooks/apt/templates/unattended-upgrades.seed.erb +1 -0
  37. data/cookbooks/build-essential/.foodcritic +1 -0
  38. data/cookbooks/build-essential/CHANGELOG.md +257 -0
  39. data/cookbooks/build-essential/CONTRIBUTING.md +2 -0
  40. data/cookbooks/build-essential/MAINTAINERS.md +15 -0
  41. data/cookbooks/build-essential/README.md +134 -0
  42. data/cookbooks/build-essential/attributes/default.rb +21 -0
  43. data/cookbooks/build-essential/libraries/matchers.rb +9 -0
  44. data/cookbooks/build-essential/metadata.json +1 -0
  45. data/cookbooks/build-essential/recipes/_windows.rb +53 -0
  46. data/cookbooks/build-essential/recipes/default.rb +24 -0
  47. data/cookbooks/build-essential/resources/build_essential.rb +106 -0
  48. data/cookbooks/build-essential/resources/xcode_command_line_tools.rb +61 -0
  49. data/cookbooks/compat_resource/CHANGELOG.md +53 -0
  50. data/cookbooks/compat_resource/CONTRIBUTING.md +2 -0
  51. data/cookbooks/compat_resource/MAINTAINERS.md +16 -0
  52. data/cookbooks/compat_resource/README.md +60 -0
  53. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/constants.rb +47 -0
  54. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/delayed_evaluator.rb +40 -0
  55. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/core.rb +73 -0
  56. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb +315 -0
  57. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/platform_introspection.rb +292 -0
  58. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/recipe.rb +37 -0
  59. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/universal.rb +70 -0
  60. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/lazy_module_include.rb +98 -0
  61. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/notifying_block.rb +74 -0
  62. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/params_validate.rb +510 -0
  63. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/powershell_out.rb +117 -0
  64. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/mixin/properties.rb +328 -0
  65. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/property.rb +713 -0
  66. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/apt_repository.rb +269 -0
  67. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/apt_update.rb +105 -0
  68. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/noop.rb +56 -0
  69. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/support/yum_repo.erb +132 -0
  70. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/systemd_unit.rb +253 -0
  71. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider/yum_repository.rb +136 -0
  72. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb +164 -0
  73. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/action_class.rb +114 -0
  74. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_repository.rb +65 -0
  75. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/apt_update.rb +52 -0
  76. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/systemd_unit.rb +81 -0
  77. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource/yum_repository.rb +97 -0
  78. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource.rb +214 -0
  79. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb +174 -0
  80. data/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef.rb +29 -0
  81. data/cookbooks/compat_resource/files/lib/chef_compat/mixin/properties.rb +8 -0
  82. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/exceptions.rb +10 -0
  83. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/log.rb +30 -0
  84. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/mixin/params_validate.rb +17 -0
  85. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/node.rb +9 -0
  86. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/property.rb +15 -0
  87. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/provider.rb +65 -0
  88. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe.rb +118 -0
  89. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/recipe_hook.rb +20 -0
  90. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource/lwrp_base.rb +60 -0
  91. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource.rb +156 -0
  92. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_builder.rb +167 -0
  93. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection/resource_list.rb +49 -0
  94. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection/resource_set.rb +49 -0
  95. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/resource_collection.rb +103 -0
  96. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/run_context.rb +691 -0
  97. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb +153 -0
  98. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef.rb +33 -0
  99. data/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches.rb +41 -0
  100. data/cookbooks/compat_resource/files/lib/chef_compat/property.rb +6 -0
  101. data/cookbooks/compat_resource/files/lib/chef_compat/recipe.rb +8 -0
  102. data/cookbooks/compat_resource/files/lib/chef_compat/resource/lwrp_base.rb +44 -0
  103. data/cookbooks/compat_resource/files/lib/chef_compat/resource.rb +56 -0
  104. data/cookbooks/compat_resource/files/lib/chef_upstream_version.rb +3 -0
  105. data/cookbooks/compat_resource/files/lib/compat_resource.rb +35 -0
  106. data/cookbooks/compat_resource/libraries/autoload.rb +31 -0
  107. data/cookbooks/compat_resource/metadata.json +1 -0
  108. data/cookbooks/inifile_chef_gem/CHANGELOG.md +11 -0
  109. data/cookbooks/inifile_chef_gem/README.md +46 -0
  110. data/cookbooks/inifile_chef_gem/metadata.json +51 -0
  111. data/cookbooks/inifile_chef_gem/metadata.rb +11 -0
  112. data/cookbooks/inifile_chef_gem/resources/default.rb +28 -0
  113. data/cookbooks/mariadb/CHANGELOG.md +332 -0
  114. data/cookbooks/mariadb/README.md +225 -0
  115. data/cookbooks/mariadb/attributes/default.rb +199 -0
  116. data/cookbooks/mariadb/libraries/mariadb_conn_helper.rb +53 -0
  117. data/cookbooks/mariadb/libraries/mariadb_helper.rb +216 -0
  118. data/cookbooks/mariadb/libraries/matchers.rb +21 -0
  119. data/cookbooks/mariadb/metadata.json +1 -0
  120. data/cookbooks/mariadb/providers/configuration.rb +39 -0
  121. data/cookbooks/mariadb/recipes/_audit_plugin.rb +63 -0
  122. data/cookbooks/mariadb/recipes/_debian_galera.rb +62 -0
  123. data/cookbooks/mariadb/recipes/_debian_server.rb +78 -0
  124. data/cookbooks/mariadb/recipes/_mariadb_repository.rb +29 -0
  125. data/cookbooks/mariadb/recipes/_redhat_client.rb +27 -0
  126. data/cookbooks/mariadb/recipes/_redhat_galera.rb +55 -0
  127. data/cookbooks/mariadb/recipes/_redhat_server.rb +58 -0
  128. data/cookbooks/mariadb/recipes/client.rb +47 -0
  129. data/cookbooks/mariadb/recipes/config.rb +115 -0
  130. data/cookbooks/mariadb/recipes/default.rb +46 -0
  131. data/cookbooks/mariadb/recipes/devel.rb +41 -0
  132. data/cookbooks/mariadb/recipes/galera.rb +324 -0
  133. data/cookbooks/mariadb/recipes/plugins.rb +3 -0
  134. data/cookbooks/mariadb/recipes/repository.rb +45 -0
  135. data/cookbooks/mariadb/recipes/server.rb +157 -0
  136. data/cookbooks/mariadb/resources/configuration.rb +13 -0
  137. data/cookbooks/mariadb/resources/mysql2_gem.rb +25 -0
  138. data/cookbooks/mariadb/resources/replication.rb +192 -0
  139. data/cookbooks/mariadb/templates/default/conf.d.generic.erb +19 -0
  140. data/cookbooks/mariadb/templates/default/debian.cnf.erb +12 -0
  141. data/cookbooks/mariadb/templates/default/mariadb-server.seed.erb +13 -0
  142. data/cookbooks/mariadb/templates/default/mariadb_grants.erb +42 -0
  143. data/cookbooks/mariadb/templates/default/my.cnf.erb +210 -0
  144. data/cookbooks/mariadb/templates/default/root.cnf.erb +5 -0
  145. data/cookbooks/mingw/.foodcritic +1 -0
  146. data/cookbooks/mingw/CHANGELOG.md +50 -0
  147. data/cookbooks/mingw/CONTRIBUTING.md +2 -0
  148. data/cookbooks/mingw/MAINTAINERS.md +14 -0
  149. data/cookbooks/mingw/README.md +133 -0
  150. data/cookbooks/mingw/files/default/bash.bat +17 -0
  151. data/cookbooks/mingw/files/default/custom-upgrade.sh +23 -0
  152. data/cookbooks/mingw/files/default/custom_prefix.sh +13 -0
  153. data/cookbooks/mingw/files/default/pthread.h +719 -0
  154. data/cookbooks/mingw/files/default/time.h +297 -0
  155. data/cookbooks/mingw/libraries/_helper.rb +38 -0
  156. data/cookbooks/mingw/metadata.json +1 -0
  157. data/cookbooks/mingw/recipes/default.rb +19 -0
  158. data/cookbooks/mingw/resources/get.rb +56 -0
  159. data/cookbooks/mingw/resources/msys2_package.rb +139 -0
  160. data/cookbooks/mingw/resources/tdm_gcc.rb +114 -0
  161. data/cookbooks/ohai/.foodcritic +2 -0
  162. data/cookbooks/ohai/CHANGELOG.md +166 -0
  163. data/cookbooks/ohai/CONTRIBUTING.md +2 -0
  164. data/cookbooks/ohai/MAINTAINERS.md +15 -0
  165. data/cookbooks/ohai/README.md +134 -0
  166. data/cookbooks/ohai/libraries/matchers.rb +41 -0
  167. data/cookbooks/ohai/metadata.json +1 -0
  168. data/cookbooks/ohai/recipes/default.rb +20 -0
  169. data/cookbooks/ohai/resources/hint.rb +55 -0
  170. data/cookbooks/ohai/resources/plugin.rb +117 -0
  171. data/cookbooks/selinux_policy/.gitignore +51 -0
  172. data/cookbooks/selinux_policy/.kitchen.yml +25 -0
  173. data/cookbooks/selinux_policy/.rubocop.yml +2 -0
  174. data/cookbooks/selinux_policy/.travis.yml +26 -0
  175. data/cookbooks/selinux_policy/Berksfile +8 -0
  176. data/cookbooks/selinux_policy/CHANGELOG.md +155 -0
  177. data/cookbooks/selinux_policy/LICENSE +13 -0
  178. data/cookbooks/selinux_policy/README.md +217 -0
  179. data/cookbooks/selinux_policy/Rakefile +68 -0
  180. data/cookbooks/selinux_policy/TESTING.md +2 -0
  181. data/cookbooks/selinux_policy/Thorfile +12 -0
  182. data/cookbooks/selinux_policy/attributes/default.rb +5 -0
  183. data/cookbooks/selinux_policy/chefignore +102 -0
  184. data/cookbooks/selinux_policy/libraries/helper-disabled.rb +29 -0
  185. data/cookbooks/selinux_policy/libraries/matchers.rb +57 -0
  186. data/cookbooks/selinux_policy/metadata.json +58 -0
  187. data/cookbooks/selinux_policy/metadata.rb +20 -0
  188. data/cookbooks/selinux_policy/providers/boolean.rb +28 -0
  189. data/cookbooks/selinux_policy/providers/fcontext.rb +78 -0
  190. data/cookbooks/selinux_policy/providers/module.rb +81 -0
  191. data/cookbooks/selinux_policy/providers/permissive.rb +26 -0
  192. data/cookbooks/selinux_policy/providers/port.rb +58 -0
  193. data/cookbooks/selinux_policy/recipes/default.rb +9 -0
  194. data/cookbooks/selinux_policy/recipes/install.rb +32 -0
  195. data/cookbooks/selinux_policy/resources/boolean.rb +8 -0
  196. data/cookbooks/selinux_policy/resources/fcontext.rb +8 -0
  197. data/cookbooks/selinux_policy/resources/module.rb +21 -0
  198. data/cookbooks/selinux_policy/resources/permissive.rb +6 -0
  199. data/cookbooks/selinux_policy/resources/port.rb +9 -0
  200. data/cookbooks/seven_zip/CHANGELOG.md +30 -0
  201. data/cookbooks/seven_zip/README.md +108 -0
  202. data/cookbooks/seven_zip/attributes/default.rb +31 -0
  203. data/cookbooks/seven_zip/libraries/matchers.rb +33 -0
  204. data/cookbooks/seven_zip/metadata.json +1 -0
  205. data/cookbooks/seven_zip/providers/archive.rb +68 -0
  206. data/cookbooks/seven_zip/recipes/default.rb +41 -0
  207. data/cookbooks/seven_zip/resources/archive.rb +29 -0
  208. data/cookbooks/windows/.foodcritic +2 -0
  209. data/cookbooks/windows/CHANGELOG.md +528 -0
  210. data/cookbooks/windows/CONTRIBUTING.md +2 -0
  211. data/cookbooks/windows/MAINTAINERS.md +21 -0
  212. data/cookbooks/windows/README.md +803 -0
  213. data/cookbooks/windows/attributes/default.rb +21 -0
  214. data/cookbooks/windows/files/dism_features.rb +45 -0
  215. data/cookbooks/windows/libraries/matchers.rb +586 -0
  216. data/cookbooks/windows/libraries/powershell_helper.rb +53 -0
  217. data/cookbooks/windows/libraries/registry_helper.rb +356 -0
  218. data/cookbooks/windows/libraries/version.rb +207 -0
  219. data/cookbooks/windows/libraries/version_helper.rb +79 -0
  220. data/cookbooks/windows/libraries/windows_helper.rb +174 -0
  221. data/cookbooks/windows/libraries/windows_privileged.rb +103 -0
  222. data/cookbooks/windows/libraries/wmi_helper.rb +32 -0
  223. data/cookbooks/windows/metadata.json +1 -0
  224. data/cookbooks/windows/recipes/default.rb +21 -0
  225. data/cookbooks/windows/resources/auto_run.rb +46 -0
  226. data/cookbooks/windows/resources/certificate.rb +166 -0
  227. data/cookbooks/windows/resources/certificate_binding.rb +128 -0
  228. data/cookbooks/windows/resources/feature.rb +82 -0
  229. data/cookbooks/windows/resources/feature_dism.rb +108 -0
  230. data/cookbooks/windows/resources/feature_powershell.rb +70 -0
  231. data/cookbooks/windows/resources/feature_servermanagercmd.rb +76 -0
  232. data/cookbooks/windows/resources/font.rb +80 -0
  233. data/cookbooks/windows/resources/http_acl.rb +110 -0
  234. data/cookbooks/windows/resources/pagefile.rb +152 -0
  235. data/cookbooks/windows/resources/path.rb +54 -0
  236. data/cookbooks/windows/resources/printer.rb +103 -0
  237. data/cookbooks/windows/resources/printer_port.rb +101 -0
  238. data/cookbooks/windows/resources/share.rb +291 -0
  239. data/cookbooks/windows/resources/shortcut.rb +53 -0
  240. data/cookbooks/windows/resources/task.rb +384 -0
  241. data/cookbooks/windows/resources/zipfile.rb +125 -0
  242. data/cookbooks/yum/.foodcritic +1 -0
  243. data/cookbooks/yum/CHANGELOG.md +351 -0
  244. data/cookbooks/yum/CONTRIBUTING.md +2 -0
  245. data/cookbooks/yum/MAINTAINERS.md +16 -0
  246. data/cookbooks/yum/README.md +125 -0
  247. data/cookbooks/yum/attributes/main.rb +103 -0
  248. data/cookbooks/yum/libraries/matchers.rb +9 -0
  249. data/cookbooks/yum/metadata.json +1 -0
  250. data/cookbooks/yum/recipes/default.rb +26 -0
  251. data/cookbooks/yum/recipes/dnf_yum_compat.rb +29 -0
  252. data/cookbooks/yum/resources/globalconfig.rb +119 -0
  253. data/cookbooks/yum/templates/.DS_Store +0 -0
  254. data/cookbooks/yum/templates/main.erb +276 -0
  255. data/cookbooks/yum-epel/CHANGELOG.md +138 -0
  256. data/cookbooks/yum-epel/CONTRIBUTING.md +2 -0
  257. data/cookbooks/yum-epel/MAINTAINERS.md +19 -0
  258. data/cookbooks/yum-epel/README.md +172 -0
  259. data/cookbooks/yum-epel/attributes/default.rb +8 -0
  260. data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +15 -0
  261. data/cookbooks/yum-epel/attributes/epel-source.rb +15 -0
  262. data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +15 -0
  263. data/cookbooks/yum-epel/attributes/epel-testing-source.rb +15 -0
  264. data/cookbooks/yum-epel/attributes/epel-testing.rb +15 -0
  265. data/cookbooks/yum-epel/attributes/epel.rb +21 -0
  266. data/cookbooks/yum-epel/metadata.json +1 -0
  267. data/cookbooks/yum-epel/recipes/default.rb +27 -0
  268. data/cookbooks/yum-scl/.kitchen.dokken.yml +24 -0
  269. data/cookbooks/yum-scl/.kitchen.yml +24 -0
  270. data/cookbooks/yum-scl/.rubocop.yml +6 -0
  271. data/cookbooks/yum-scl/.travis.yml +28 -0
  272. data/cookbooks/yum-scl/Berksfile +3 -0
  273. data/cookbooks/yum-scl/Berksfile.lock +25 -0
  274. data/cookbooks/yum-scl/CHANGELOG.md +11 -0
  275. data/cookbooks/yum-scl/Gemfile +46 -0
  276. data/cookbooks/yum-scl/README.md +76 -0
  277. data/cookbooks/yum-scl/attributes/centos.rb +83 -0
  278. data/cookbooks/yum-scl/attributes/default.rb +15 -0
  279. data/cookbooks/yum-scl/attributes/scientific.rb +1 -0
  280. data/cookbooks/yum-scl/files/default/RPM-GPG-KEY-CentOS-SIG-SCLo +20 -0
  281. data/cookbooks/yum-scl/libraries/yum_scl_helper.rb +33 -0
  282. data/cookbooks/yum-scl/metadata.json +42 -0
  283. data/cookbooks/yum-scl/metadata.rb +12 -0
  284. data/cookbooks/yum-scl/recipes/chef_install.rb +52 -0
  285. data/cookbooks/yum-scl/recipes/default.rb +17 -0
  286. data/cookbooks/yum-scl/recipes/native_install.rb +35 -0
  287. data/lib/vagrant-clone/command/clone.rb +66 -61
  288. data/lib/vagrant-clone/errors.rb +61 -0
  289. data/lib/vagrant-clone/util/clone_manager_base.rb +69 -0
  290. data/lib/vagrant-clone/util/clone_managers/docker.rb +31 -0
  291. data/lib/vagrant-clone/util/clone_managers/libvirt.rb +254 -0
  292. data/lib/vagrant-clone/util/vagrantfile_managers/docker.rb +154 -0
  293. data/lib/vagrant-clone/util/vagrantfile_managers/libvirt.rb +159 -0
  294. data/lib/vagrant-clone/version.rb +2 -2
  295. data/lib/vagrant-clone.rb +6 -6
  296. data/libvirt.txt +7 -0
  297. data/performance_testing.rb +165 -0
  298. data/results.txt +45 -0
  299. data/scripts/create_box.sh +134 -0
  300. data/test.rb +92 -0
  301. data/tools/create_box.sh +130 -0
  302. data/vagrant-clone.gemspec +7 -7
  303. metadata +296 -5
  304. data/lib/vagrant-clone/command/errors.rb +0 -16
  305. data/lib/vagrant-clone/command/provider/docker.rb +0 -13
  306. data/lib/vagrant-clone/utils/vagrantfile_manager.rb +0 -47
@@ -0,0 +1,199 @@
1
+ # platform dependent attributes
2
+ case node['platform']
3
+ when 'redhat', 'centos', 'scientific', 'amazon'
4
+ default['mariadb']['configuration']['path'] = '/etc'
5
+ default['mariadb']['configuration']['includedir'] = '/etc/my.cnf.d'
6
+ default['mariadb']['mysqld']['socket'] = '/var/lib/mysql/mysql.sock'
7
+ default['mariadb']['client']['socket'] = '/var/lib/mysql/mysql.sock'
8
+ default['mariadb']['mysqld_safe']['socket'] = '/var/lib/mysql/mysql.sock'
9
+ else
10
+ default['mariadb']['configuration']['path'] = '/etc/mysql'
11
+ default['mariadb']['configuration']['includedir'] = '/etc/mysql/conf.d'
12
+ default['mariadb']['mysqld']['socket'] = '/var/run/mysqld/mysqld.sock'
13
+ default['mariadb']['mysqld']['pid_file'] = '/var/run/mysqld/mysqld.pid'
14
+ default['mariadb']['client']['socket'] = '/var/run/mysqld/mysqld.sock'
15
+ default['mariadb']['mysqld_safe']['socket'] = '/var/run/mysqld/mysqld.sock'
16
+ end
17
+
18
+ default['mariadb']['sections'] = %w(mysql mysqldump mysqlcheck mysqladmin mysqlshow)
19
+
20
+ #
21
+ # mysqld default configuration
22
+ #
23
+ default['mariadb']['remove_anonymous_users'] = true
24
+ default['mariadb']['remove_test_database'] = true
25
+ default['mariadb']['forbid_remote_root'] = true
26
+ default['mariadb']['server_root_password'] = ''
27
+ default['mariadb']['root_my_cnf'] = false
28
+ default['mariadb']['allow_root_pass_change'] = false
29
+ default['mariadb']['mysqld']['service_name'] = if node['platform'] == 'centos'
30
+ 'mariadb'
31
+ else
32
+ 'mysql'
33
+ end
34
+ default['mariadb']['mysqld']['user'] = 'mysql'
35
+ default['mariadb']['mysqld']['port'] = '3306'
36
+ default['mariadb']['mysqld']['basedir'] = '/usr'
37
+ default['mariadb']['mysqld']['default_datadir'] = '/var/lib/mysql'
38
+ # if different from previous value, datadir will be moved after install
39
+ # you will have to take care about apparmor/SELinux
40
+ default['mariadb']['mysqld']['datadir'] = '/var/lib/mysql'
41
+ default['mariadb']['mysqld']['tmpdir'] = '/var/tmp'
42
+ default['mariadb']['mysqld']['lc_messages_dir'] = '/usr/share/mysql'
43
+ default['mariadb']['mysqld']['lc_messages'] = 'en_US'
44
+ default['mariadb']['mysqld']['skip_external_locking'] = 'true'
45
+ default['mariadb']['mysqld']['skip_log_bin'] = 'false'
46
+ default['mariadb']['mysqld']['skip_name_resolve'] = 'false'
47
+ default['mariadb']['mysqld']['bind_address'] = '127.0.0.1'
48
+ default['mariadb']['mysqld']['max_connections'] = '100'
49
+ default['mariadb']['mysqld']['max_statement_time'] = ''
50
+ default['mariadb']['mysqld']['connect_timeout'] = '5'
51
+ default['mariadb']['mysqld']['wait_timeout'] = '600'
52
+ default['mariadb']['mysqld']['max_allowed_packet'] = '16M'
53
+ default['mariadb']['mysqld']['thread_cache_size'] = '128'
54
+ default['mariadb']['mysqld']['sort_buffer_size'] = '4M'
55
+ default['mariadb']['mysqld']['bulk_insert_buffer_size'] = '16M'
56
+ default['mariadb']['mysqld']['tmp_table_size'] = '32M'
57
+ default['mariadb']['mysqld']['max_heap_table_size'] = '32M'
58
+ default['mariadb']['mysqld']['myisam_recover'] = 'BACKUP'
59
+ default['mariadb']['mysqld']['key_buffer_size'] = '128M'
60
+ # if not defined default is 2000
61
+ default['mariadb']['mysqld']['open_files_limit'] = ''
62
+ default['mariadb']['mysqld']['table_open_cache'] = '400'
63
+ default['mariadb']['mysqld']['myisam_sort_buffer_size'] = '512M'
64
+ default['mariadb']['mysqld']['concurrent_insert'] = '2'
65
+ default['mariadb']['mysqld']['read_buffer_size'] = '2M'
66
+ default['mariadb']['mysqld']['read_rnd_buffer_size'] = '1M'
67
+ default['mariadb']['mysqld']['query_cache_limit'] = '128K'
68
+ default['mariadb']['mysqld']['query_cache_size'] = '64M'
69
+ # if not defined default is ON
70
+ default['mariadb']['mysqld']['query_cache_type'] = ''
71
+ default['mariadb']['mysqld']['default_storage_engine'] = 'InnoDB'
72
+ default['mariadb']['mysqld']['options'] = {}
73
+ # logging
74
+ default['mariadb']['mysqld']['general_log_file'] = '/var/log/mysql/mysql.log'
75
+ default['mariadb']['mysqld']['general_log'] = 0
76
+ default['mariadb']['mysqld']['log_warnings'] = 2
77
+ default['mariadb']['mysqld']['slow_query_log'] = 0
78
+ default['mariadb']['mysqld']['slow_query_log_file'] = '/var/log/mysql/mariadb-slow.log'
79
+ default['mariadb']['mysqld']['long_query_time'] = 10
80
+ default['mariadb']['mysqld']['log_slow_rate_limit'] = 1000
81
+ default['mariadb']['mysqld']['log_slow_verbosity'] = 'query_plan'
82
+ default['mariadb']['mysqld']['log_output'] = 'FILE'
83
+ #
84
+ # InnoDB default configuration
85
+ #
86
+ # if not defined default is 50M
87
+ default['mariadb']['innodb']['log_file_size'] = ''
88
+ default['mariadb']['innodb']['bps_percentage_memory'] = false
89
+ default['mariadb']['innodb']['buffer_pool_size'] = '256M'
90
+ default['mariadb']['innodb']['log_buffer_size'] = '8M'
91
+ default['mariadb']['innodb']['file_per_table'] = '1'
92
+ default['mariadb']['innodb']['open_files'] = '400'
93
+ default['mariadb']['innodb']['io_capacity'] = '400'
94
+ default['mariadb']['innodb']['flush_method'] = 'O_DIRECT'
95
+ default['mariadb']['innodb']['options'] = {}
96
+
97
+ #
98
+ # Galera default configuration
99
+ #
100
+ default['mariadb']['galera']['cluster_name'] = 'galera_cluster'
101
+ default['mariadb']['galera']['cluster_search_query'] = ''
102
+ # All Galera nodes should get the same server_id
103
+ default['mariadb']['galera']['server_id'] = '100'
104
+ default['mariadb']['galera']['wsrep_sst_method'] = 'rsync'
105
+ default['mariadb']['galera']['wsrep_sst_auth'] = 'sstuser:some_secret_password'
106
+ default['mariadb']['galera']['wsrep_provider'] = \
107
+ '/usr/lib/galera/libgalera_smm.so'
108
+ default['mariadb']['galera']['wsrep_slave_threads'] = '4'
109
+ # Default value is '1' but can be relaxed to '2' or even '0' with Galera
110
+ default['mariadb']['galera']['innodb_flush_log_at_trx_commit'] = '2'
111
+ default['mariadb']['galera']['wsrep_node_address_interface'] = ''
112
+ default['mariadb']['galera']['wsrep_node_port'] = ''
113
+ default['mariadb']['galera']['wsrep_node_incoming_address_interface'] = ''
114
+ default['mariadb']['galera']['wsrep_provider_options'] = {
115
+ 'gcache.size' => '512M'
116
+ }
117
+ default['mariadb']['galera']['options'] = {}
118
+
119
+ # Node format: [{ :name => "mariadb_1", fqdn: "33.33.33.11"}]
120
+ default['mariadb']['galera']['cluster_nodes'] = []
121
+
122
+ #
123
+ # Replication default configuration
124
+ #
125
+ default['mariadb']['replication']['server_id'] = ''
126
+ default['mariadb']['replication']['log_bin'] = \
127
+ '/var/log/mysql/mariadb-bin'
128
+ default['mariadb']['replication']['log_bin_index'] = \
129
+ '/var/log/mysql/mariadb-bin.index'
130
+ # Setting sync_binlog to 1 will cause a performance impact
131
+ default['mariadb']['replication']['sync_binlog'] = '0'
132
+ default['mariadb']['replication']['expire_logs_days'] = '10'
133
+ default['mariadb']['replication']['max_binlog_size'] = '100M'
134
+ default['mariadb']['replication']['options'] = {}
135
+
136
+ #
137
+ # mysqldump default configuration
138
+ #
139
+ default['mariadb']['mysqldump']['quick'] = 'true'
140
+ default['mariadb']['mysqldump']['quote_names'] = 'true'
141
+ default['mariadb']['mysqldump']['max_allowed_packet'] = '16M'
142
+
143
+ #
144
+ # isamchk default configuration
145
+ default['mariadb']['isamchk']['key_buffer'] = '16M'
146
+
147
+ #
148
+ # mysqld_safe default configuration
149
+ #
150
+ default['mariadb']['mysqld_safe']['options'] = {}
151
+
152
+ #
153
+ # client default configuration
154
+ #
155
+ default['mariadb']['client']['port'] = 3306
156
+ default['mariadb']['client']['options'] = {}
157
+ default['mariadb']['client']['development_files'] = true
158
+
159
+ #
160
+ # debian specific configuration
161
+ #
162
+ default['mariadb']['debian']['user'] = 'debian-sys-maint'
163
+ default['mariadb']['debian']['password'] = 'please-change-me'
164
+ default['mariadb']['debian']['host'] = 'localhost'
165
+
166
+ #
167
+ # mariadb default install configuration
168
+ #
169
+ # install valid value is 'package',
170
+ # hope to have 'from_source' in the near future
171
+ default['mariadb']['install']['type'] = 'package'
172
+ default['mariadb']['install']['version'] = '10.0'
173
+ default['mariadb']['install']['prefer_os_package'] = false
174
+ default['mariadb']['install']['prefer_scl_package'] = false
175
+ default['mariadb']['install']['extra_packages'] = true
176
+
177
+ #
178
+ # package(apt or yum) default configuration
179
+ #
180
+ default['mariadb']['use_default_repository'] = false
181
+ default['mariadb']['apt_repository']['base_url'] = \
182
+ 'ftp.igh.cnrs.fr/pub/mariadb/repo'
183
+
184
+ #
185
+ # MariaDB Plugins enabling
186
+ #
187
+ default['mariadb']['plugins_options']['auto_install'] = true
188
+ # Enabling Plugin Installation
189
+ default['mariadb']['plugins']['audit'] = false
190
+ # Load Plugins in .cnf (plugin-loadi variable)
191
+ default['mariadb']['plugins_loading']['audit'] = 'server_audit=server_audit.so'
192
+
193
+ # Default Configuration
194
+ default['mariadb']['audit_plugin']['server_audit_events'] = ''
195
+ default['mariadb']['audit_plugin']['server_audit_output_type'] = 'file'
196
+ # Syslog(require server_audit_output_type = syslog)
197
+ default['mariadb']['audit_plugin']['server_audit_syslog_facility'] = 'LOG_USER'
198
+ default['mariadb']['audit_plugin']['server_audit_syslog_priority'] = 'LOG_INFO'
199
+ default['mariadb']['audit_plugin']['server_audit_logging'] = 'OFF'
@@ -0,0 +1,53 @@
1
+ # MariaDB is a module containing mariadb cookbook helpers
2
+ module MariaDB
3
+ # Connection is a module containing helpers for mysql connection handling
4
+ module Connection
5
+ # Helper module for mariadb cookbook
6
+ module Helper
7
+ def initialize(new_resource, run_context)
8
+ super
9
+ mysql2_gem 'mysql2' do
10
+ compile_time true
11
+ action :install
12
+ end
13
+ @connection_pool ||= {}
14
+ end
15
+
16
+ def connect(host:, port: '3306', username:, password: nil, socket: nil)
17
+ require 'mysql2'
18
+ unless @connection_pool["#{username}@#{host}"]
19
+ conn_options = { username: username,
20
+ password: password,
21
+ port: port }.merge!(socket.nil? ? { host: host } : { socket: socket })
22
+ @connection_pool["#{username}@#{host}"] = Mysql2::Client.new(conn_options)
23
+ end
24
+ @connection_pool["#{username}@#{host}"]
25
+ end
26
+
27
+ def connected?(host, username)
28
+ !@connection_pool["#{username}@#{host}"].nil?
29
+ end
30
+
31
+ def disconnect(host, username)
32
+ require 'mysql2'
33
+ if @connection_pool["#{username}@#{host}"]
34
+ @connection_pool["#{username}@#{host}"].close
35
+ else
36
+ Chef::Log.warn("Close mysql connections: Couldn't find connection #{username}@#{host} in the pool.")
37
+ end
38
+ rescue Mysql2::Error => mysql_exception
39
+ Chef::Log.warn("Close mysql connections: #{mysql_exception.message}.")
40
+ ensure
41
+ @connection_pool.delete_if { |connection_name, _| connection_name == "#{username}@#{host}" }
42
+ end
43
+
44
+ def query(host, username, query)
45
+ raise "Connection to mysql #{username}@#{host} is not established. Can't run query." unless connected?(host, username)
46
+ @connection_pool["#{username}@#{host}"].query(query)
47
+ rescue Mysql2::Error => mysql_exception
48
+ raise if mysql_exception.message =~ /There is no master connection.*/
49
+ raise "Mysql query error: #{mysql_exception.message}"
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,216 @@
1
+ # MariaDB is a module containing mariadb cookbook helper
2
+ module MariaDB
3
+ # Helper module for mariadb cookbook
4
+ module Helper
5
+ require 'socket'
6
+ require 'timeout'
7
+
8
+ def do_port_connect(ip, port)
9
+ s = TCPSocket.new(ip, port)
10
+ s.close
11
+ true
12
+ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
13
+ false
14
+ end
15
+
16
+ def port_open?(ip, port)
17
+ begin
18
+ Timeout.timeout(5) do
19
+ return do_port_connect(ip, port)
20
+ end
21
+ rescue Timeout::Error
22
+ false
23
+ end
24
+ false
25
+ end
26
+
27
+ # Trying to determine if we need to restart the mysql service
28
+ def mariadb_service_restart_required?(ip, port, _socket)
29
+ restart = false
30
+ restart = true unless port_open?(ip, port)
31
+ restart
32
+ end
33
+
34
+ # Helper to determine if running operating system shipped a package for
35
+ # mariadb server & client. No galera shipped in any os yet.
36
+ # @param [String] os_platform Indicate operating system type, e.g. centos
37
+ # @param [String] os_version Indicate operating system version, e.g. 7.0
38
+ def os_package_provided?(os_platform, os_version)
39
+ package_provided = false
40
+ case os_platform
41
+ when 'centos', 'redhat'
42
+ package_provided = true if os_version.to_i == 7
43
+ end
44
+ package_provided
45
+ end
46
+
47
+ # Helper to determine if running operating system's scl provides a package
48
+ # mariadb server & client. No galera shipped in any os yet.
49
+ # @param [String] os_platform Indicate operating system type, e.g. centos
50
+ # @param [String] os_version Indicate operating system version, e.g. 7.0
51
+ def scl_package_provided?(os_platform, os_version)
52
+ package_provided = false
53
+ case os_platform
54
+ when 'centos', 'redhat', 'scientific'
55
+ package_provided = true if os_version.to_i >= 6
56
+ end
57
+ package_provided
58
+ end
59
+
60
+ # Helper to determine whether to use os native package
61
+ # @param [Boolean] prefer_os Indicate whether to prefer os native package
62
+ # @param [String] os_platform Indicate operating system type, e.g. centos
63
+ # @param [String] os_version Indicate operating system version, e.g. 7.0
64
+ def use_os_native_package?(prefer_os, os_platform, os_version)
65
+ return false unless prefer_os
66
+ if os_package_provided?(os_platform, os_version)
67
+ true
68
+ else
69
+ Chef::Log.warn 'prefer_os_package detected, but no native mariadb'\
70
+ " package available on #{os_platform}-#{os_version}."\
71
+ ' Fall back to use community package.'
72
+ false
73
+ end
74
+ end
75
+
76
+ # Helper to determine whether to use scl package
77
+ # @param [Boolean] prefer_scl Indicate whether to prefer package from SCL
78
+ # @param [String] os_platform Indicate operating system type, e.g. centos
79
+ # @param [String] os_version Indicate operating system version, e.g. 7.0
80
+ def use_scl_package?(prefer_scl, os_platform, os_version)
81
+ return false unless prefer_scl
82
+ if scl_package_provided?(os_platform, os_version)
83
+ true
84
+ else
85
+ Chef::Log.warn 'prefer_scl_package detected, but no scl mariadb'\
86
+ " package available on #{os_platform}-#{os_version}."\
87
+ ' Fall back to use community package.'
88
+ false
89
+ end
90
+ end
91
+
92
+ # Helper to determine whether requested version is available from scl repo
93
+ # @param [String] version Indicate requested version of mariadb
94
+ def scl_version_available?(mariadb_version)
95
+ if ['5.5', '10.0', '10.1'].include?(mariadb_version)
96
+ true
97
+ else
98
+ Chef::Log.warn "Version #{mariadb_version} was requested, but"\
99
+ ' but not available from scl. Fall back to use community package.'
100
+ false
101
+ end
102
+ end
103
+
104
+ # Helper to determine scl package name's prefix
105
+ # @param [String] version Indicate requested version of mariadb
106
+ def scl_collection_name(mariadb_version)
107
+ case mariadb_version
108
+ when '5.5'
109
+ 'mariadb55'
110
+ when '10.0'
111
+ 'rh-mariadb100'
112
+ when '10.1'
113
+ 'rh-mariadb101'
114
+ end
115
+ end
116
+
117
+ # Helper to determine scl packages names
118
+ # @param [String] version Indicate requested version of mariadb
119
+ # @param [String] package Indicate mariadb component name
120
+ def scl_package_name(version, package)
121
+ "#{scl_collection_name(version)}-#{package}"
122
+ end
123
+
124
+ # Helper to determine the command required to execute mariadb utils
125
+ # @param [Boolean] prefer_scl Indicate whether to prefer package from SCL
126
+ # @param [String] mariadb_version Indicate requested version of mariadb
127
+ # @param [String] cmd Indicate what command has to be executed
128
+ def mysqlbin_cmd(prefer_scl, mariadb_version, cmd)
129
+ if prefer_scl && scl_version_available?(mariadb_version)
130
+ "scl enable #{scl_collection_name(mariadb_version)} -- #{cmd}"
131
+ else
132
+ "/usr/bin/#{cmd}"
133
+ end
134
+ end
135
+
136
+ # Helper to determine names of mariadb packages provided by OS
137
+ # @param [String] os_platform Indicate operating system type, e.g. centos
138
+ def native_packages_names(os_platform)
139
+ case os_platform
140
+ when 'redhat', 'centos', 'scientific'
141
+ { 'devel' => 'mariadb-devel',
142
+ 'client' => 'mariadb',
143
+ 'server' => 'mariadb-server' }
144
+ when 'suse'
145
+ { 'devel' => 'libmariadbclient-devel',
146
+ 'client' => 'mariadb-community-server-client',
147
+ 'server' => 'mariadb-community-server' }
148
+ when 'debian', 'ubuntu'
149
+ { 'devel' => 'libmariadbclient-dev',
150
+ 'client' => 'mariadb-client',
151
+ 'server' => 'mariadb-server' }
152
+ end
153
+ end
154
+
155
+ # Helper to determine names of mariadb packages provided by SCL
156
+ # @param [String] os_platform Indicate operating system type, e.g. centos
157
+ # @param [String] mariadb_version Indicate requested version of mariadb
158
+ def scl_packages_names(os_platform, mariadb_version)
159
+ packages = {}
160
+ native_packages_names(os_platform).each_pair do |package_type, package_name|
161
+ packages[package_type] = scl_package_name(mariadb_version, package_name)
162
+ end
163
+ packages
164
+ end
165
+
166
+ # Helper to determine names of mariadb packages provided by MariaDB
167
+ # @param [String] os_platform Indicate operating system type, e.g. centos
168
+ # @param [String] version Indicate requested version of mariadb
169
+ def mariadb_packages_names(os_platform, version)
170
+ if %w(debian ubuntu).include?(os_platform)
171
+ { 'devel' => 'libmariadbclient-dev',
172
+ 'client' => "mariadb-client-#{version}",
173
+ 'server' => "mariadb-server-#{version}" }
174
+ else
175
+ { 'devel' => 'MariaDB-devel',
176
+ 'client' => 'MariaDB-client',
177
+ 'server' => 'MariaDB-server' }
178
+ end
179
+ end
180
+
181
+ # Helper to determine names of packages to be used for chosen mariadb version
182
+ # @param [String] os_platform Indicate operating system type, e.g. centos
183
+ # @param [String] os_version Indicate operating system version
184
+ # @param [String] mariadb_version Indicate requested version of mariadb
185
+ # @param [Boolean] prefer_os Indicate whether to prefer os native package
186
+ # @param [Boolean] prefer_scl Indicate whether to prefer package from SCL
187
+ def packages_names_to_install(os_platform, os_version, mariadb_version, prefer_os, prefer_scl)
188
+ if use_os_native_package?(prefer_os, os_platform, os_version)
189
+ native_packages_names(os_platform)
190
+ elsif use_scl_package?(prefer_scl, os_platform, os_version)
191
+ scl_packages_names(os_platform, mariadb_version)
192
+ else
193
+ mariadb_packages_names(os_platform, mariadb_version)
194
+ end
195
+ end
196
+
197
+ # Helper to determine service name for given OS and chosen installation method
198
+ # @param [String] os_platform Indicate operating system type, e.g. centos
199
+ # @param [String] os_version Indicate operating system version
200
+ # @param [String] mariadb_version Indicate requested version of mariadb
201
+ # @param [Boolean] prefer_os Indicate whether to prefer os native package
202
+ # @param [Boolean] prefer_scl Indicate whether to prefer package from SCL
203
+ def mariadb_service_name(os_platform, os_version, mariadb_version, prefer_os, prefer_scl)
204
+ if use_os_native_package?(prefer_os, os_platform, os_version)
205
+ case os_platform
206
+ when 'redhat', 'centos', 'scientific', 'debian', 'ubuntu'
207
+ 'mariadb'
208
+ end
209
+ elsif use_scl_package?(prefer_scl, os_platform, os_version)
210
+ "#{scl_collection_name(mariadb_version)}-mariadb"
211
+ else
212
+ 'mysql'
213
+ end
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,21 @@
1
+ if defined?(ChefSpec)
2
+ def add_mariadb_configuration(resource_name)
3
+ ChefSpec::Matchers::ResourceMatcher
4
+ .new(:mariadb_configuration, :add, resource_name)
5
+ end
6
+
7
+ def remove_mariadb_configuration(resource_name)
8
+ ChefSpec::Matchers::ResourceMatcher
9
+ .new(:mariadb_configuration, :remove, resource_name)
10
+ end
11
+
12
+ def add_mariadb_replication(resource_name)
13
+ ChefSpec::Matchers::ResourceMatcher
14
+ .new(:mariadb_replication, :add, resource_name)
15
+ end
16
+
17
+ def remove_mariadb_replication(resource_name)
18
+ ChefSpec::Matchers::ResourceMatcher
19
+ .new(:mariadb_replication, :remove, resource_name)
20
+ end
21
+ end
@@ -0,0 +1 @@
1
+ {"name":"mariadb","version":"1.5.1","description":"Installs/Configures MariaDB","long_description":"MariaDB Cookbook\n================\n\n[![Build Status](https://travis-ci.org/sinfomicien/mariadb.svg?branch=master)](https://travis-ci.org/sinfomicien/mariadb) [![Cookbook Version](https://img.shields.io/cookbook/v/mariadb.svg)](https://supermarket.chef.io/cookbooks/mariadb)\n\nDescription\n-----------\n\nThis cookbook contains all the stuffs to install and configure a mariadb server on a dpkg/apt compliant system (typically debian), or a rpm/yum compliant system (typically centos)\n\n\nRequirements\n------------\n\n#### repository\n- `mariadb` - This cookbook need that you have a valid apt repository installed with the mariadb official packages\n\n#### packages\n- `percona-xtrabackup` - if you want to use the xtrabckup SST Auth for galera cluster.\n- `socat` - if you want to use the xtrabckup SST Auth for galera cluster.\n- `rsync` - if you want to use the rsync SST Auth for galera cluster.\n- `debconf-utils` - if you use debian platform family.\n\n#### operating system\n- `debian` - this cookbook is fully tested on debian\n- `ubuntu` - this cookbook is fully tested on ubuntu\n- `centos` - this cookbook is fully tested on centos\n\nAttributes\n----------\n\n#### mariadb::default\n<table>\n <tr>\n <th>Key</th>\n <th>Type</th>\n <th>Description</th>\n <th>Default</th>\n </tr>\n <tr>\n <td><tt>['mariadb']['install']['version']</tt></td>\n <td>String</td>\n <td>Version to install (currently 10.0 et 5.5)</td>\n <td><tt>10.0</tt></td>\n </tr>\n <tr>\n <td><tt>['mariadb']['use_default_repository']</tt></td>\n <td>Boolean</td>\n <td>Whether to install MariaDB default repository or not. If you don't have a local repo containing packages, put it to true</td>\n <td><tt>false</tt></td>\n </tr>\n <tr>\n <td><tt>['mariadb']['server_root_password']</tt></td>\n <td>String</td>\n <td>local root password</td>\n <td><tt></tt></td>\n </tr>\n <tr>\n <td><tt>['mariadb']['forbid_remote_root']</tt></td>\n <td>Boolean</td>\n <td>Whether to activate root remote access</td>\n <td><tt>true</tt></td>\n </tr>\n <tr>\n <td><tt>['mariadb']['allow_root_pass_change']</tt></td>\n <td>Boolean</td>\n <td>Whether to allow the recipe to change root password after the first install</td>\n <td><tt>false</tt></td>\n </tr>\n <tr>\n <td><tt>['mariadb']['client']['development_files']</tt></td>\n <td>Boolean</td>\n <td>Whether to install development files in client recipe</td>\n <td><tt>true</tt></td>\n </tr>\n <tr>\n <td><tt>['mariadb']['apt_repository']['base_url']</tt></td>\n <td>String</td>\n <td>The http base url to use when installing from default repository</td>\n <td><tt>'ftp.igh.cnrs.fr/pub/mariadb/repo'</tt></td>\n </tr>\n <tr>\n <td><tt>['mariadb']['install']['prefer_os_package']</tt></td>\n <td>Boolean</td>\n <td>Indicator for preferring use packages shipped by running os</td>\n <td><tt>false</tt></td>\n </tr>\n <tr>\n <td><tt>['mariadb']['install']['prefer_scl_package']</tt></td>\n <td>Boolean</td>\n <td>Indicator for preferring packages from software collections repository</td>\n <td><tt>false</tt></td>\n </tr>\n</table>\n\nUsage\n-----\n\nTo install a default server for mariadb choose the version you want (MariaDB 5.5 or 10, galera or not), then call the recipe accordingly.\n\nList of availables recipes:\n\n- mariadb::default (just call server recipe with default options)\n- mariadb::server\n- mariadb::galera\n- mariadb::client\n- mariadb::devel\n\nPlease be ware that by default, the root password is empty! If you want have changed it use the `node['mariadb']['server_root_password']` attribute to put a correct value. And by default the remote root access is not activated. Use `node['mariadb']['forbid_remote_root']` attribute to change it.\n\nSometimes, the default apt repository used for apt does not work (see issue #6). In this case, you need to choose another mirror which worki (pick it from mariadb website), and put the http base url in the attribute `node['mariadb']['apt_repository']['base_url']`.\n\n#### mariadb::galera\n\nWhen installing the mariadb::galera on debian recipe, You have to take care of one specific attribute:\n`node['mariadb']['debian']['password']` which default to 'please-change-me'\nAs wee need to have the same password for this user on the whole cluster nodes... We will change the default install one by the content of this attribute.\n\n#### mariadb::client\n\nBy default this recipe installs the client, and all needed packages to develop client application. If you do not want to install development files when installing client package,\nset the attribute `node['mariadb']['client']['development_files']` to false. \n\n#### mariadb::devel\n\nBy default this recipe installs all needed packages to develop client application.\n\nProviders\n----------\n\nThis recipe define 2 providers:\n- `Chef::Provider::Mariadb::Configuration` shortcut resource `mariadb_configuration`\n\n#### mariadb_configuration\n\nMainly use for internal purpose. You can use it to create a new configuration file into configuration dir. You have to define 2 variables `section` and `option`.\nWhere `section` is the configuration section, and `option` is a hash of key/value. The name of the resource is used as base for the filename.\n\nExample:\n```ruby\nmariadb_configuration 'fake' do\n section 'mysqld'\n option :innodb_buffer_pool_size => node['mysql']['innodb_buffer_pool_size'],\n :innodb_flush_method => node['mysql']['innodb_flush_method']\nend\n```\nwill become the file fake.cnf in the include dir (depend on your platform), which contain:\n```\n[mysqld]\nfoo=bar\n```\n\nIf the value start with a '#', then it's considered as a comment, and the value is printed as is (without the key)\n\nExample:\n```ruby\nmariadb_configuration 'fake' do\n section 'mysqld'\n option :comment1 => '# Here i am',\n :foo => bar\nend\n```\nwill become the file fake.cnf in the include dir (depend on your platform), which contain:\n```\n[mysqld]\n# Here i am\nfoo=bar\n```\n\n#### mariadb_replication\n\nThis LWRP is used to manage replication setup on a host. To use this LWRP, the node need to have the mysql binary installed (via the mariadb::client or mariadb::server or mariadb::galera recipe).\nIt have 4 actions:\n- add - to add a new replication setup (become a slave)\n- stop - to stop the slave replication\n- start - to start the slave replication\n- remove - to remove the slave replication configuration\n\nThe resource name need to be 'default' if your don't want to use a named connection (multi source replication in MariaDB 10).\n\nSo by default the provider try to use the local instance of mysql, with the current root and password set in attribute node['mariadb']['server_root_password']. If you want to change, you have to define `host`, `port`, `user` or `password`\n\n```ruby\nmariadb_replication 'default' do\n user 'root'\n password 'fakepass'\n host 'fakehost'\n action :stop\nend\n```\nwill stop the replication on the host `fakehost` using the user `root` and password `fakepass` to connect to.\n\nWhen you add a replication configuration, you have to define at least 4 values `master_host`, `master_user`, `master_password` and `master_use_gtid`. And if you don't want the GTID support, you have to define also `master_log_file` and `master_log_pos`\n\nExample:\n```ruby\nmariadb_replication 'usefull_conn_name' do\n master_host 'server1'\n master_user 'slave_user'\n master_password 'slave_password'\n master_use_gtid 'current_pos'\n action :add\nend\n```\n\nBy default, resource doesn't change master if slave is running. If you want to let resource change slave settings for replication channel while slave is running use `change_master_while_running` property. When it's set to `true` slave settings will be changed\nif either one of `master_host`, `master_port`, `master_user`, `master_password` and `master_use_gtid` was changed.\n\nChanges of only `master_log_file` and/or `master_log_pos` don't affect server if slave is already configured.\n\n\nContributing\n------------\n\n1. Fork the repository on Github\n2. Create a named feature branch (like `add_component_x`)\n3. Write your change\n4. Write tests for your change (if applicable)\n5. Run the tests, ensuring they all pass\n6. Submit a Pull Request using Github\n\nLicense and Authors\n-------------------\nAuthors:\nNicolas Blanc <sinfomicien@gmail.com>\n","maintainer":"Nicolas Blanc","maintainer_email":"sinfomicien@gmail.com","license":"Apache 2.0","platforms":{"ubuntu":">= 0.0.0","debian":">= 7.0","centos":">= 6.4","redhat":">= 7.0"},"dependencies":{"apt":">= 0.0.0","build-essential":">= 0.0.0","selinux_policy":"~> 2.0","yum":">= 0.0.0","yum-epel":">= 0.0.0","yum-scl":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sinfomicien/mariadb","issues_url":"https://github.com/sinfomicien/mariadb/issues","chef_version":">= 12.6","ohai_version":{}}
@@ -0,0 +1,39 @@
1
+ #
2
+ # Cookbook Name:: mariadb
3
+ # Provider:: configuration
4
+ #
5
+
6
+ use_inline_resources if defined?(use_inline_resources)
7
+
8
+ def whyrun_supported?
9
+ true
10
+ end
11
+
12
+ action :add do
13
+ variables_hash = {
14
+ section: new_resource.section,
15
+ options: new_resource.option
16
+ }
17
+ template node['mariadb']['configuration']['includedir'] + \
18
+ '/' + new_resource.name + '.cnf' do
19
+ source 'conf.d.generic.erb'
20
+ owner 'root'
21
+ group 'mysql'
22
+ mode '0640'
23
+ cookbook 'mariadb'
24
+ variables variables_hash
25
+ sensitive true
26
+ end
27
+ end
28
+
29
+ action :remove do
30
+ if ::File.exist?(node['mariadb']['configuration']['includedir'] + \
31
+ '/' + new_resource.name + '.cnf')
32
+ Chef::Log.info "Removing #{new_resource.name} repository from " + \
33
+ node['mariadb']['configuration']['includedir']
34
+ file node['mariadb']['configuration']['includedir'] + \
35
+ '/' + new_resource.name + '.cnf' do
36
+ action :delete
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,63 @@
1
+ # Prepare Configuration File
2
+ audit_plugin_options = {}
3
+
4
+ audit_plugin_options['comment1'] = '#'
5
+ audit_plugin_options['comment2'] = '# * MariaDB Audit Plugin'
6
+ audit_plugin_options['comment3'] = '#'
7
+
8
+ audit_plugin_options['server_audit_events'] = \
9
+ node['mariadb']['audit_plugin']['server_audit_events']
10
+ audit_plugin_options['server_audit_output_type'] = \
11
+ node['mariadb']['audit_plugin']['server_audit_output_type']
12
+ audit_plugin_options['server_audit_syslog_facility'] = \
13
+ node['mariadb']['audit_plugin']['server_audit_syslog_facility']
14
+ audit_plugin_options['server_audit_syslog_priority'] = \
15
+ node['mariadb']['audit_plugin']['server_audit_syslog_priority']
16
+ audit_plugin_options['server_audit_logging'] = \
17
+ node['mariadb']['audit_plugin']['server_audit_logging']
18
+
19
+ # Install the MariaDB Audit Plugin
20
+ mysql_cmd = mysqlbin_cmd(node['mariadb']['install']['prefer_scl_package'],
21
+ node['mariadb']['install']['version'],
22
+ 'mysql')
23
+ execute 'install_mariadb_audit_plugin' do
24
+ command "#{mysql_cmd} -u root --password=" + \
25
+ node['mariadb']['server_root_password'] + \
26
+ " -e \"INSTALL PLUGIN server_audit SONAME 'server_audit';\""
27
+ notifies :run, 'execute[configure_mariadb_audit_plugin]', :immediately
28
+ sensitive true
29
+ not_if do
30
+ cmd = Mixlib::ShellOut.new("#{mysql_cmd} -u root " \
31
+ '--password=' + \
32
+ node['mariadb']['server_root_password'] + \
33
+ ' -B -N -e "SELECT 1 ' \
34
+ 'FROM information_schema.plugins ' \
35
+ "WHERE PLUGIN_NAME = 'SERVER_AUDIT'" \
36
+ "AND PLUGIN_STATUS = 'ACTIVE';\"")
37
+ cmd.run_command
38
+ cmd.stdout.to_i == 1
39
+ end
40
+ end
41
+
42
+ # Configure (Dynamic)
43
+ execute 'configure_mariadb_audit_plugin' do
44
+ command 'echo "SET GLOBAL server_audit_events=\'' + \
45
+ node['mariadb']['audit_plugin']['server_audit_events'] + '\';' \
46
+ 'SET GLOBAL server_audit_output_type=\'' + \
47
+ node['mariadb']['audit_plugin']['server_audit_output_type'] + '\';' \
48
+ 'SET GLOBAL server_audit_syslog_facility=\'' + \
49
+ node['mariadb']['audit_plugin']['server_audit_syslog_facility'] + '\';' \
50
+ 'SET GLOBAL server_audit_syslog_priority=\'' + \
51
+ node['mariadb']['audit_plugin']['server_audit_syslog_priority'] + '\';' \
52
+ 'SET GLOBAL server_audit_logging=\'' + \
53
+ node['mariadb']['audit_plugin']['server_audit_logging'] + '\';" ' \
54
+ "| #{mysql_cmd}"
55
+ action :nothing
56
+ end
57
+
58
+ # Create Configuration File
59
+ mariadb_configuration 'audit_plugin' do
60
+ section 'mysqld'
61
+ option audit_plugin_options
62
+ action :add
63
+ end