freighthop 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. data/Puppetfile +1 -0
  2. data/Puppetfile.lock +3 -0
  3. data/Vagrantfile +1 -1
  4. data/bin/fh +2 -78
  5. data/lib/freighthop/cli/help.rb +69 -0
  6. data/lib/freighthop/cli/ssh.rb +46 -0
  7. data/lib/freighthop/cli/vagrant.rb +26 -0
  8. data/lib/freighthop/cli.rb +40 -0
  9. data/lib/freighthop/config.rb +4 -0
  10. data/lib/freighthop/vagrant_env.rb +24 -0
  11. data/lib/freighthop/version.rb +1 -1
  12. data/lib/freighthop.rb +7 -4
  13. data/local_modules/freighthop/manifests/database/mysql.pp +20 -0
  14. data/local_modules/freighthop/manifests/database/postgres.pp +6 -6
  15. data/local_modules/freighthop/manifests/database.pp +6 -8
  16. data/local_modules/freighthop/manifests/init.pp +1 -8
  17. data/local_modules/freighthop/manifests/params.pp +0 -3
  18. data/modules/apt/CHANGELOG +12 -2
  19. data/modules/apt/Gemfile +6 -5
  20. data/modules/apt/Gemfile.lock +40 -5
  21. data/modules/apt/Modulefile +1 -1
  22. data/modules/apt/README.md +2 -1
  23. data/modules/apt/Rakefile +1 -0
  24. data/modules/apt/manifests/init.pp +4 -1
  25. data/modules/apt/manifests/ppa.pp +1 -1
  26. data/modules/apt/manifests/update.pp +1 -0
  27. data/modules/apt/metadata.json +21 -13
  28. data/modules/apt/spec/defines/ppa_spec.rb +3 -3
  29. data/modules/apt/spec/defines/source_spec.rb +2 -2
  30. data/modules/apt/spec/spec_helper_system.rb +30 -0
  31. data/modules/apt/spec/system/apt_builddep_spec.rb +38 -0
  32. data/modules/apt/spec/system/apt_key_spec.rb +53 -0
  33. data/modules/apt/spec/system/apt_ppa_spec.rb +59 -0
  34. data/modules/apt/spec/system/apt_source_spec.rb +51 -0
  35. data/modules/apt/spec/system/basic_spec.rb +10 -0
  36. data/modules/apt/spec/system/class_spec.rb +20 -0
  37. data/modules/apt/templates/source.list.erb +2 -2
  38. data/modules/freighthop/manifests/database/mysql.pp +20 -0
  39. data/modules/freighthop/manifests/database/postgres.pp +6 -6
  40. data/modules/freighthop/manifests/database.pp +6 -8
  41. data/modules/freighthop/manifests/init.pp +1 -8
  42. data/modules/freighthop/manifests/params.pp +0 -3
  43. data/modules/mysql/CHANGELOG +403 -0
  44. data/modules/mysql/Gemfile +24 -0
  45. data/modules/mysql/Gemfile.lock +129 -0
  46. data/modules/mysql/LICENSE +201 -0
  47. data/modules/mysql/Modulefile +9 -0
  48. data/modules/mysql/README.md +492 -0
  49. data/modules/mysql/Rakefile +2 -0
  50. data/modules/mysql/TODO +8 -0
  51. data/modules/mysql/files/mysqltuner.pl +966 -0
  52. data/modules/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb +52 -0
  53. data/modules/mysql/lib/puppet/parser/functions/mysql_password.rb +15 -0
  54. data/modules/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb +21 -0
  55. data/modules/mysql/lib/puppet/provider/database/mysql.rb +52 -0
  56. data/modules/mysql/lib/puppet/provider/database_grant/mysql.rb +210 -0
  57. data/modules/mysql/lib/puppet/provider/database_user/mysql.rb +76 -0
  58. data/modules/mysql/lib/puppet/provider/mysql.rb +67 -0
  59. data/modules/mysql/lib/puppet/provider/mysql_database/mysql.rb +68 -0
  60. data/modules/mysql/lib/puppet/provider/mysql_grant/mysql.rb +115 -0
  61. data/modules/mysql/lib/puppet/provider/mysql_user/mysql.rb +115 -0
  62. data/modules/mysql/lib/puppet/type/database.rb +21 -0
  63. data/modules/mysql/lib/puppet/type/database_grant.rb +79 -0
  64. data/modules/mysql/lib/puppet/type/database_user.rb +31 -0
  65. data/modules/mysql/lib/puppet/type/mysql_database.rb +22 -0
  66. data/modules/mysql/lib/puppet/type/mysql_grant.rb +72 -0
  67. data/modules/mysql/lib/puppet/type/mysql_user.rb +45 -0
  68. data/modules/mysql/manifests/backup.pp +31 -0
  69. data/modules/mysql/manifests/bindings/java.pp +10 -0
  70. data/modules/mysql/manifests/bindings/perl.pp +10 -0
  71. data/modules/mysql/manifests/bindings/php.pp +10 -0
  72. data/modules/mysql/manifests/bindings/python.pp +10 -0
  73. data/modules/mysql/manifests/bindings/ruby.pp +10 -0
  74. data/modules/mysql/manifests/bindings.pp +33 -0
  75. data/modules/mysql/manifests/client/install.pp +8 -0
  76. data/modules/mysql/manifests/client.pp +27 -0
  77. data/modules/mysql/manifests/db.pp +59 -0
  78. data/modules/mysql/manifests/init.pp +100 -0
  79. data/modules/mysql/manifests/params.pp +230 -0
  80. data/modules/mysql/manifests/server/account_security.pp +22 -0
  81. data/modules/mysql/manifests/server/backup.pp +56 -0
  82. data/modules/mysql/manifests/server/config.pp +31 -0
  83. data/modules/mysql/manifests/server/install.pp +9 -0
  84. data/modules/mysql/manifests/server/monitor.pp +24 -0
  85. data/modules/mysql/manifests/server/mysqltuner.pp +9 -0
  86. data/modules/mysql/manifests/server/providers.pp +8 -0
  87. data/modules/mysql/manifests/server/root_password.pp +21 -0
  88. data/modules/mysql/manifests/server/service.pp +19 -0
  89. data/modules/mysql/manifests/server.pp +69 -0
  90. data/modules/mysql/metadata.json +289 -0
  91. data/modules/mysql/spec/classes/mysql_bindings_spec.rb +58 -0
  92. data/modules/mysql/spec/classes/mysql_client_spec.rb +16 -0
  93. data/modules/mysql/spec/classes/mysql_server_account_security_spec.rb +41 -0
  94. data/modules/mysql/spec/classes/mysql_server_backup_spec.rb +112 -0
  95. data/modules/mysql/spec/classes/mysql_server_monitor_spec.rb +31 -0
  96. data/modules/mysql/spec/classes/mysql_server_mysqltuner_spec.rb +5 -0
  97. data/modules/mysql/spec/classes/mysql_server_spec.rb +162 -0
  98. data/modules/mysql/spec/defines/mysql_db_spec.rb +51 -0
  99. data/modules/mysql/spec/spec.opts +6 -0
  100. data/modules/mysql/spec/spec_helper.rb +5 -0
  101. data/modules/mysql/spec/spec_helper_system.rb +28 -0
  102. data/modules/mysql/spec/system/mysql_account_delete_spec.rb +35 -0
  103. data/modules/mysql/spec/system/mysql_backup_spec.rb +77 -0
  104. data/modules/mysql/spec/system/mysql_bindings_spec.rb +90 -0
  105. data/modules/mysql/spec/system/mysql_db_spec.rb +61 -0
  106. data/modules/mysql/spec/system/mysql_server_monitor_spec.rb +30 -0
  107. data/modules/mysql/spec/system/mysql_server_root_password_spec.rb +71 -0
  108. data/modules/mysql/spec/system/mysql_server_spec.rb +85 -0
  109. data/modules/mysql/spec/system/types/mysql_grant_spec.rb +314 -0
  110. data/modules/mysql/spec/system/types/mysql_user_spec.rb +35 -0
  111. data/modules/mysql/spec/unit/mysql_password_spec.rb +27 -0
  112. data/modules/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb +77 -0
  113. data/modules/mysql/spec/unit/puppet/provider/database/mysql_spec.rb +86 -0
  114. data/modules/mysql/spec/unit/puppet/provider/database_grant/mysql_spec.rb +95 -0
  115. data/modules/mysql/spec/unit/puppet/provider/database_user/mysql_spec.rb +119 -0
  116. data/modules/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb +118 -0
  117. data/modules/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb +130 -0
  118. data/modules/mysql/spec/unit/puppet/type/mysql_database_spec.rb +29 -0
  119. data/modules/mysql/spec/unit/puppet/type/mysql_user_spec.rb +30 -0
  120. data/modules/mysql/templates/my.cnf.erb +17 -0
  121. data/modules/mysql/templates/my.cnf.pass.erb +7 -0
  122. data/modules/mysql/templates/my.conf.cnf.erb +17 -0
  123. data/modules/mysql/templates/mysqlbackup.sh.erb +57 -0
  124. data/modules/mysql/tests/backup.pp +8 -0
  125. data/modules/mysql/tests/bindings.pp +3 -0
  126. data/modules/mysql/tests/init.pp +1 -0
  127. data/modules/mysql/tests/java.pp +1 -0
  128. data/modules/mysql/tests/mysql_database.pp +12 -0
  129. data/modules/mysql/tests/mysql_grant.pp +5 -0
  130. data/modules/mysql/tests/mysql_user.pp +23 -0
  131. data/modules/mysql/tests/perl.pp +1 -0
  132. data/modules/mysql/tests/python.pp +1 -0
  133. data/modules/mysql/tests/ruby.pp +1 -0
  134. data/modules/mysql/tests/server/account_security.pp +4 -0
  135. data/modules/mysql/tests/server/config.pp +11 -0
  136. data/modules/mysql/tests/server.pp +3 -0
  137. data/modules/postgresql/Changelog +191 -0
  138. data/modules/postgresql/Gemfile +1 -0
  139. data/modules/postgresql/Gemfile.lock +9 -0
  140. data/modules/postgresql/LICENSE +198 -12
  141. data/modules/postgresql/Modulefile +2 -2
  142. data/modules/postgresql/NOTICE +14 -0
  143. data/modules/postgresql/README.md +435 -184
  144. data/modules/postgresql/files/validate_postgresql_connection.sh +31 -0
  145. data/modules/postgresql/lib/puppet/provider/postgresql_conf/parsed.rb +37 -0
  146. data/modules/postgresql/lib/puppet/provider/postgresql_psql/ruby.rb +4 -0
  147. data/modules/postgresql/lib/puppet/type/postgresql_conf.rb +31 -0
  148. data/modules/postgresql/lib/puppet/type/postgresql_psql.rb +4 -0
  149. data/modules/postgresql/manifests/client.pp +17 -16
  150. data/modules/postgresql/manifests/globals.pp +95 -0
  151. data/modules/postgresql/manifests/lib/devel.pp +15 -0
  152. data/modules/postgresql/manifests/lib/java.pp +15 -0
  153. data/modules/postgresql/manifests/lib/python.pp +13 -0
  154. data/modules/postgresql/manifests/params.pp +127 -222
  155. data/modules/postgresql/manifests/repo/apt_postgresql_org.pp +30 -0
  156. data/modules/postgresql/manifests/repo/yum_postgresql_org.pp +38 -0
  157. data/modules/postgresql/manifests/repo.pp +22 -0
  158. data/modules/postgresql/manifests/server/config.pp +113 -0
  159. data/modules/postgresql/manifests/server/config_entry.pp +43 -0
  160. data/modules/postgresql/manifests/server/contrib.pp +27 -0
  161. data/modules/postgresql/manifests/server/database.pp +75 -0
  162. data/modules/postgresql/manifests/server/database_grant.pp +18 -0
  163. data/modules/postgresql/manifests/server/db.pp +36 -0
  164. data/modules/postgresql/manifests/server/firewall.pp +21 -0
  165. data/modules/postgresql/manifests/server/grant.pp +81 -0
  166. data/modules/postgresql/manifests/server/initdb.pp +52 -0
  167. data/modules/postgresql/manifests/server/install.pp +49 -0
  168. data/modules/postgresql/manifests/server/passwd.pp +34 -0
  169. data/modules/postgresql/manifests/server/pg_hba_rule.pp +54 -0
  170. data/modules/postgresql/manifests/server/plperl.pp +27 -0
  171. data/modules/postgresql/manifests/server/reload.pp +15 -0
  172. data/modules/postgresql/manifests/{role.pp → server/role.pp} +19 -33
  173. data/modules/postgresql/manifests/server/service.pp +40 -0
  174. data/modules/postgresql/manifests/{table_grant.pp → server/table_grant.pp} +4 -4
  175. data/modules/postgresql/manifests/server/tablespace.pp +42 -0
  176. data/modules/postgresql/manifests/server.pp +61 -83
  177. data/modules/postgresql/manifests/validate_db_connection.pp +49 -50
  178. data/modules/postgresql/metadata.json +123 -73
  179. data/modules/postgresql/spec/spec_helper_system.rb +13 -1
  180. data/modules/postgresql/spec/system/client_spec.rb +22 -0
  181. data/modules/postgresql/spec/system/common_patterns_spec.rb +53 -0
  182. data/modules/postgresql/spec/system/contrib_spec.rb +33 -0
  183. data/modules/postgresql/spec/system/lib/devel_spec.rb +22 -0
  184. data/modules/postgresql/spec/system/lib/java_spec.rb +25 -0
  185. data/modules/postgresql/spec/system/lib/python_spec.rb +24 -0
  186. data/modules/postgresql/spec/system/postgresql_psql_spec.rb +51 -0
  187. data/modules/postgresql/spec/system/server/config_entry_spec.rb +32 -0
  188. data/modules/postgresql/spec/system/server/database_grant_spec.rb +54 -0
  189. data/modules/postgresql/spec/system/server/database_spec.rb +35 -0
  190. data/modules/postgresql/spec/system/server/db_spec.rb +143 -0
  191. data/modules/postgresql/spec/system/server/grant_spec.rb +55 -0
  192. data/modules/postgresql/spec/system/server/pg_hba_rule_spec.rb +85 -0
  193. data/modules/postgresql/spec/system/server/plperl_spec.rb +29 -0
  194. data/modules/postgresql/spec/system/server/role_spec.rb +103 -0
  195. data/modules/postgresql/spec/system/server/table_grant_spec.rb +72 -0
  196. data/modules/postgresql/spec/system/server/tablespace_spec.rb +74 -0
  197. data/modules/postgresql/spec/system/server_spec.rb +217 -0
  198. data/modules/postgresql/spec/system/validate_db_connection_spec.rb +91 -0
  199. data/modules/postgresql/spec/unit/classes/client_spec.rb +27 -2
  200. data/modules/postgresql/spec/unit/classes/globals_spec.rb +28 -0
  201. data/modules/postgresql/spec/unit/classes/lib/devel_spec.rb +12 -0
  202. data/modules/postgresql/spec/unit/classes/{postgresql_java_spec.rb → lib/java_spec.rb} +9 -19
  203. data/modules/postgresql/spec/unit/classes/lib/python_spec.rb +31 -0
  204. data/modules/postgresql/spec/unit/classes/params_spec.rb +2 -1
  205. data/modules/postgresql/spec/unit/classes/repo_spec.rb +17 -0
  206. data/modules/postgresql/spec/unit/classes/server/contrib_spec.rb +42 -0
  207. data/modules/postgresql/spec/unit/classes/server/initdb_spec.rb +28 -0
  208. data/modules/postgresql/spec/unit/classes/server/plperl_spec.rb +45 -0
  209. data/modules/postgresql/spec/unit/classes/server_spec.rb +83 -2
  210. data/modules/postgresql/spec/unit/defines/server/config_entry_spec.rb +23 -0
  211. data/modules/postgresql/spec/unit/defines/server/database_grant_spec.rb +26 -0
  212. data/modules/postgresql/spec/unit/defines/server/database_spec.rb +16 -0
  213. data/modules/postgresql/spec/unit/defines/server/db_spec.rb +28 -0
  214. data/modules/postgresql/spec/unit/defines/{database_grant_spec.rb → server/grant_spec.rb} +7 -4
  215. data/modules/postgresql/spec/unit/defines/{pg_hba_rule_spec.rb → server/pg_hba_rule_spec.rb} +59 -2
  216. data/modules/postgresql/spec/unit/defines/server/role_spec.rb +23 -0
  217. data/modules/postgresql/spec/unit/defines/server/table_grant_spec.rb +27 -0
  218. data/modules/postgresql/spec/unit/defines/server/tablespace_spec.rb +23 -0
  219. data/modules/postgresql/spec/unit/defines/validate_db_connection_spec.rb +22 -9
  220. data/modules/postgresql/spec/unit/provider/postgresql_conf/parsed_spec.rb +112 -0
  221. data/modules/postgresql/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb +29 -0
  222. data/modules/postgresql/spec/unit/puppet/type/postgresql_psql_spec.rb +1 -0
  223. data/modules/postgresql/spec/unit/type/postgresql_conf_spec.rb +50 -0
  224. metadata +177 -53
  225. data/modules/postgresql/examples/init.pp +0 -1
  226. data/modules/postgresql/examples/official-postgresql-repos.pp +0 -19
  227. data/modules/postgresql/examples/postgresql_database.pp +0 -22
  228. data/modules/postgresql/examples/postgresql_db.pp +0 -30
  229. data/modules/postgresql/examples/postgresql_grant.pp +0 -14
  230. data/modules/postgresql/examples/postgresql_pg_hba_rule.pp +0 -18
  231. data/modules/postgresql/examples/postgresql_pgconf_extras.pp +0 -19
  232. data/modules/postgresql/examples/postgresql_tablespace.pp +0 -73
  233. data/modules/postgresql/examples/postgresql_user.pp +0 -28
  234. data/modules/postgresql/examples/server.pp +0 -10
  235. data/modules/postgresql/lib/facter/postgres_default_version.rb +0 -69
  236. data/modules/postgresql/manifests/config/afterservice.pp +0 -47
  237. data/modules/postgresql/manifests/config/beforeservice.pp +0 -171
  238. data/modules/postgresql/manifests/config.pp +0 -74
  239. data/modules/postgresql/manifests/contrib.pp +0 -29
  240. data/modules/postgresql/manifests/database.pp +0 -85
  241. data/modules/postgresql/manifests/database_grant.pp +0 -35
  242. data/modules/postgresql/manifests/database_user.pp +0 -60
  243. data/modules/postgresql/manifests/db.pp +0 -77
  244. data/modules/postgresql/manifests/devel.pp +0 -27
  245. data/modules/postgresql/manifests/grant.pp +0 -77
  246. data/modules/postgresql/manifests/init.pp +0 -145
  247. data/modules/postgresql/manifests/initdb.pp +0 -52
  248. data/modules/postgresql/manifests/java.pp +0 -29
  249. data/modules/postgresql/manifests/package_source/apt_postgresql_org.pp +0 -21
  250. data/modules/postgresql/manifests/package_source/yum_postgresql_org.pp +0 -30
  251. data/modules/postgresql/manifests/pg_hba.pp +0 -19
  252. data/modules/postgresql/manifests/pg_hba_rule.pp +0 -41
  253. data/modules/postgresql/manifests/plperl.pp +0 -24
  254. data/modules/postgresql/manifests/psql.pp +0 -56
  255. data/modules/postgresql/manifests/python.pp +0 -18
  256. data/modules/postgresql/manifests/tablespace.pp +0 -59
  257. data/modules/postgresql/spec/system/install_spec.rb +0 -707
  258. data/modules/postgresql/spec/system/non_defaults_spec.rb +0 -114
  259. data/modules/postgresql/spec/unit/classes/contrib_spec.rb +0 -11
  260. data/modules/postgresql/spec/unit/classes/devel_spec.rb +0 -11
  261. data/modules/postgresql/spec/unit/classes/init_spec.rb +0 -71
  262. data/modules/postgresql/spec/unit/classes/postgresql_python_spec.rb +0 -53
  263. data/modules/postgresql/spec/unit/defines/database_spec.rb +0 -14
  264. data/modules/postgresql/spec/unit/defines/database_user_spec.rb +0 -19
  265. data/modules/postgresql/spec/unit/defines/db_spec.rb +0 -20
  266. data/modules/postgresql/spec/unit/defines/pg_hba_spec.rb +0 -20
  267. data/modules/postgresql/spec/unit/defines/psql_spec.rb +0 -20
  268. data/modules/postgresql/spec/unit/defines/role_spec.rb +0 -14
  269. data/modules/postgresql/spec/unit/defines/tablespace_spec.rb +0 -19
  270. data/modules/postgresql/spec/unit/facts/postgres_default_version_spec.rb +0 -14
@@ -1,60 +0,0 @@
1
- # puppet-postgresql
2
- # For all details and documentation:
3
- # http://github.com/inkling/puppet-postgresql
4
- #
5
- # Copyright 2012- Inkling Systems, 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
- # Define: postgresql::database_user
20
- #
21
- # This type creates a postgres database user.
22
- #
23
- # Parameters:
24
- # [*user*] - username to create.
25
- # [*password_hash*] - user's password; this may be clear text, or an md5 hash as returned by the
26
- # "postgresql_password" function in this module.
27
- #
28
- # Actions:
29
- #
30
- # Requires:
31
- #
32
- #
33
- # Sample Usage:
34
- #
35
- # postgresql::database_user { 'frank':
36
- # password_hash => postgresql_password('frank', 'password'),
37
- # }
38
- #
39
-
40
- define postgresql::database_user(
41
- $password_hash = false,
42
- $createdb = false,
43
- $createrole = false,
44
- $db = $postgresql::params::user,
45
- $superuser = false,
46
- $replication = false,
47
- $connection_limit = '-1',
48
- $user = $title
49
- ) {
50
- postgresql::role { $user:
51
- db => $db,
52
- password_hash => $password_hash,
53
- login => true,
54
- createdb => $createdb,
55
- superuser => $superuser,
56
- createrole => $createrole,
57
- replication => $replication,
58
- connection_limit => $connection_limit,
59
- }
60
- }
@@ -1,77 +0,0 @@
1
- # Define: postgresql::db
2
- #
3
- # This module creates database instances, a user, and grants that user
4
- # privileges to the database.
5
- #
6
- # Since it requires class postgresql::server, we assume to run all commands as the
7
- # postgresql user against the local postgresql server.
8
- #
9
- # TODO: support an array of privileges for "grant"; currently only supports a single
10
- # privilege, which is pretty useless unless that privilege is "ALL"
11
- #
12
- # Parameters:
13
- # [*title*] - postgresql database name.
14
- # [*user*] - username to create and grant access.
15
- # [*password*] - user's password. may be md5-encoded, in the format returned by the "postgresql_password"
16
- # function in this module
17
- # [*charset*] - database charset. defaults to 'utf8'
18
- # [*grant*] - privilege to grant user. defaults to 'all'.
19
- # [*tablespace*] - database tablespace. default to use the template database's tablespace.
20
- # [*locale*] - locale for database. defaults to 'undef' (effectively 'C').
21
- # [*istemplate*] - determines whether or not to define database as a template. defaults to false.
22
- #
23
- # Actions:
24
- #
25
- # Requires:
26
- #
27
- # class postgresql::server
28
- #
29
- # Sample Usage:
30
- #
31
- # postgresql::db { 'mydb':
32
- # user => 'my_user',
33
- # password => 'password',
34
- # grant => 'all'
35
- # }
36
- #
37
- define postgresql::db (
38
- $user,
39
- $password,
40
- $charset = $postgresql::params::charset,
41
- $locale = $postgresql::params::locale,
42
- $grant = 'ALL',
43
- $tablespace = undef,
44
- $istemplate = false
45
- ) {
46
- include postgresql::params
47
-
48
- postgresql::database { $name:
49
- # TODO: ensure is not yet supported
50
- #ensure => present,
51
- charset => $charset,
52
- tablespace => $tablespace,
53
- #provider => 'postgresql',
54
- require => Class['postgresql::server'],
55
- locale => $locale,
56
- istemplate => $istemplate,
57
- }
58
-
59
- if ! defined(Postgresql::Database_user[$user]) {
60
- postgresql::database_user { $user:
61
- # TODO: ensure is not yet supported
62
- #ensure => present,
63
- password_hash => $password,
64
- #provider => 'postgresql',
65
- require => Postgresql::Database[$name],
66
- }
67
- }
68
-
69
- postgresql::database_grant { "GRANT ${user} - ${grant} - ${name}":
70
- privilege => $grant,
71
- db => $name,
72
- role => $user,
73
- #provider => 'postgresql',
74
- require => [Postgresql::Database[$name], Postgresql::Database_user[$user]],
75
- }
76
-
77
- }
@@ -1,27 +0,0 @@
1
- # Class: postgresql::devel
2
- #
3
- # This class installs postgresql development libraries
4
- #
5
- # Parameters:
6
- # [*package_name*] - The name of the postgresql development package.
7
- # [*package_ensure*] - The ensure value of the package
8
- #
9
- # Actions:
10
- #
11
- # Requires:
12
- #
13
- # Sample Usage:
14
- #
15
- class postgresql::devel(
16
- $package_name = $postgresql::params::devel_package_name,
17
- $package_ensure = 'present'
18
- ) inherits postgresql::params {
19
-
20
- validate_string($package_name)
21
-
22
- package { 'postgresql-devel':
23
- ensure => $package_ensure,
24
- name => $package_name,
25
- tag => 'postgresql',
26
- }
27
- }
@@ -1,77 +0,0 @@
1
- # Resource postgresql::grant
2
- #
3
- # TODO: in mysql module, the grant resource name might look like this: 'user@host/dbname';
4
- # I think that the API for the resource type should split these up, because it's
5
- # easier / safer to recombine them for mysql than it is to parse them for other
6
- # databases. Also, in the mysql module, the hostname portion of that string
7
- # affects the user's ability to connect from remote hosts. In postgres this is
8
- # managed via pg_hba.conf; not sure if we want to try to reconcile that difference
9
- # in the modules or not.
10
- define postgresql::grant (
11
- $role,
12
- $db,
13
- # TODO: mysql supports an array of privileges here. We should do that if we
14
- # port this to ruby.
15
- $privilege = undef,
16
- $object_type = 'database',
17
- $object_name = $db,
18
- $psql_db = $postgresql::params::user,
19
- $psql_user = $postgresql::params::user
20
- ) {
21
-
22
- ## Munge the input values
23
- $_object_type = upcase($object_type)
24
- $_privilege = upcase($privilege)
25
-
26
- ## Validate that the object type is known
27
- validate_string($_object_type,
28
- #'COLUMN',
29
- 'DATABASE',
30
- #'FOREIGN SERVER',
31
- #'FOREIGN DATA WRAPPER',
32
- #'FUNCTION',
33
- #'PROCEDURAL LANGUAGE',
34
- #'SCHEMA',
35
- #'SEQUENCE',
36
- 'TABLE',
37
- #'TABLESPACE',
38
- #'VIEW',
39
- )
40
-
41
- ## Validate that the object type's privilege is acceptable
42
- case $_object_type {
43
- 'DATABASE': {
44
- validate_string($_privilege,'CREATE','CONNECT','TEMPORARY','TEMP','ALL','ALL PRIVILEGES')
45
- $unless_function = 'has_database_privilege'
46
- $on_db = $psql_db
47
- }
48
- 'TABLE': {
49
- validate_string($_privilege,'SELECT','INSERT','UPDATE','REFERENCES','ALL','ALL PRIVILEGES')
50
- $unless_function = 'has_table_privilege'
51
- $on_db = $db
52
- }
53
- default: {
54
- fail("Missing privilege validation for object type ${_object_type}")
55
- }
56
- }
57
-
58
- # TODO: this is a terrible hack; if they pass "ALL" as the desired privilege,
59
- # we need a way to test for it--and has_database_privilege does not recognize
60
- # 'ALL' as a valid privilege name. So we probably need to hard-code a mapping
61
- # between 'ALL' and the list of actual privileges that it entails, and loop
62
- # over them to check them. That sort of thing will probably need to wait until
63
- # we port this over to ruby, so, for now, we're just going to assume that if
64
- # they have "CREATE" privileges on a database, then they have "ALL". (I told
65
- # you that it was terrible!)
66
- $unless_privilege = $_privilege ? {
67
- 'ALL' => 'CREATE',
68
- default => $_privilege,
69
- }
70
- postgresql_psql { "GRANT ${_privilege} ON ${_object_type} \"${object_name}\" TO \"${role}\"":
71
- db => $on_db,
72
- psql_user => $psql_user,
73
- psql_group => $postgresql::params::group,
74
- psql_path => $postgresql::params::psql_path,
75
- unless => "SELECT 1 WHERE ${unless_function}('${role}', '${object_name}', '${unless_privilege}')",
76
- }
77
- }
@@ -1,145 +0,0 @@
1
- # == Class: postgresql
2
- #
3
- # This is a base class that can be used to modify catalog-wide settings relating
4
- # to the various types in class contained in the postgresql module.
5
- #
6
- # If you don't declare this class in your catalog, sensible defaults will
7
- # be used. However, if you choose to declare it, it needs to appear *before*
8
- # any other types or classes from the postgresql module.
9
- #
10
- # For examples, see the files in the `tests` directory; in particular,
11
- # `/server-yum-postgresql-org.pp`.
12
- #
13
- # === Parameters
14
- #
15
- # [*version*]
16
- # The postgresql version to install. If not specified, the
17
- # module will use whatever version is the default for your
18
- # OS distro.
19
- # [*manage_package_repo*]
20
- # This determines whether or not the module should
21
- # attempt to manage the postgres package repository for your
22
- # distro. Defaults to `false`, but if set to `true`, it can
23
- # be used to set up the official postgres yum/apt package
24
- # repositories for you.
25
- # [*package_source*]
26
- # This setting is only used if `manage_package_repo` is
27
- # set to `true`. It determines which package repository should
28
- # be used to install the postgres packages. Currently supported
29
- # values include `yum.postgresql.org`.
30
- # [*locale*]
31
- # This setting defines the default locale for initdb and createdb
32
- # commands. This default to 'undef' which is effectively 'C'.
33
- # [*charset*]
34
- # Sets the default charset to be used for initdb and createdb.
35
- # Defaults to 'UTF8'.
36
- # [*datadir*]
37
- # This setting can be used to override the default postgresql
38
- # data directory for the target platform. If not specified, the
39
- # module will use whatever directory is the default for your
40
- # OS distro.
41
- # [*confdir*]
42
- # This setting can be used to override the default postgresql
43
- # configuration directory for the target platform. If not
44
- # specified, the module will use whatever directory is the
45
- # default for your OS distro.
46
- # [*bindir*]
47
- # This setting can be used to override the default postgresql
48
- # binaries directory for the target platform. If not
49
- # specified, the module will use whatever directory is the
50
- # default for your OS distro.
51
- # [*client_package_name*]
52
- # This setting can be used to override the default
53
- # postgresql client package name. If not specified, the module
54
- # will use whatever package name is the default for your
55
- # OS distro.
56
- # [*server_package_name*]
57
- # This setting can be used to override the default
58
- # postgresql server package name. If not specified, the module
59
- # will use whatever package name is the default for your
60
- # OS distro.
61
- # [*contrib_package_name*]
62
- # This setting can be used to override the default
63
- # postgresql contrib package name. If not specified, the module
64
- # will use whatever package name is the default for your
65
- # OS distro.
66
- # [*devel_package_name*]
67
- # This setting can be used to override the default
68
- # postgresql devel package name. If not specified, the module
69
- # will use whatever package name is the default for your
70
- # OS distro.
71
- # [*java_package_name*]
72
- # This setting can be used to override the default
73
- # postgresql java package name. If not specified, the module
74
- # will use whatever package name is the default for your
75
- # OS distro.
76
- # [*service_name*]
77
- # This setting can be used to override the default
78
- # postgresql service name. If not specified, the module
79
- # will use whatever service name is the default for your
80
- # OS distro.
81
- # [*user*]
82
- # This setting can be used to override the default
83
- # postgresql super user and owner of postgresql related files
84
- # in the file system. If not specified, the module will use
85
- # the user name 'postgres'.
86
- # [*group*]
87
- # This setting can be used to override the default
88
- # postgresql user group to be used for related files
89
- # in the file system. If not specified, the module will use
90
- # the group name 'postgres'.
91
- # [*run_initdb*]
92
- # This setting can be used to explicitly call the initdb
93
- # operation after server package is installed and before
94
- # the postgresql service is started. If not specified, the
95
- # module will decide whether to call initdb or not depending
96
- # on your OS distro.
97
- #
98
- # === Examples
99
- #
100
- # class { 'postgresql':
101
- # version => '9.2',
102
- # manage_package_repo => true,
103
- # }
104
- #
105
- #
106
- class postgresql (
107
- $version = $::postgres_default_version,
108
- $manage_package_repo = false,
109
- $package_source = undef,
110
- $locale = undef,
111
- $charset = 'UTF8',
112
- $datadir = undef,
113
- $confdir = undef,
114
- $bindir = undef,
115
- $client_package_name = undef,
116
- $server_package_name = undef,
117
- $contrib_package_name = undef,
118
- $devel_package_name = undef,
119
- $java_package_name = undef,
120
- $service_name = undef,
121
- $user = undef,
122
- $group = undef,
123
- $run_initdb = undef
124
- ) {
125
-
126
- class { 'postgresql::params':
127
- version => $version,
128
- manage_package_repo => $manage_package_repo,
129
- package_source => $package_source,
130
- locale => $locale,
131
- charset => $charset,
132
- custom_datadir => $datadir,
133
- custom_confdir => $confdir,
134
- custom_bindir => $bindir,
135
- custom_client_package_name => $client_package_name,
136
- custom_server_package_name => $server_package_name,
137
- custom_contrib_package_name => $contrib_package_name,
138
- custom_devel_package_name => $devel_package_name,
139
- custom_java_package_name => $java_package_name,
140
- custom_service_name => $service_name,
141
- custom_user => $user,
142
- custom_group => $group,
143
- run_initdb => $run_initdb,
144
- }
145
- }
@@ -1,52 +0,0 @@
1
- # puppet-postgresql
2
- # For all details and documentation:
3
- # http://github.com/inkling/puppet-postgresql
4
- #
5
- # Copyright 2012- Inkling Systems, 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
- class postgresql::initdb(
20
- $datadir = $postgresql::params::datadir,
21
- $encoding = $postgresql::params::charset,
22
- $group = $postgresql::params::group,
23
- $initdb_path = $postgresql::params::initdb_path,
24
- $user = $postgresql::params::user
25
- ) inherits postgresql::params {
26
- # Build up the initdb command.
27
- #
28
- # We optionally add the locale switch if specified. Older versions of the
29
- # initdb command don't accept this switch. So if the user didn't pass the
30
- # parameter, lets not pass the switch at all.
31
- $initdb_command = $postgresql::params::locale ? {
32
- undef => "${initdb_path} --encoding '${encoding}' --pgdata '${datadir}'",
33
- default => "${initdb_path} --encoding '${encoding}' --pgdata '${datadir}' --locale '${postgresql::params::locale}'"
34
- }
35
-
36
- # This runs the initdb command, we use the existance of the PG_VERSION file to
37
- # ensure we don't keep running this command.
38
- exec { 'postgresql_initdb':
39
- command => $initdb_command,
40
- creates => "${datadir}/PG_VERSION",
41
- user => $user,
42
- group => $group,
43
- logoutput => on_failure,
44
- }
45
-
46
- # If we manage the package (which is user configurable) make sure the
47
- # package exists first.
48
- if defined(Package[$postgresql::params::server_package_name]) {
49
- Package[$postgresql::params::server_package_name]->
50
- Exec['postgresql_initdb']
51
- }
52
- }
@@ -1,29 +0,0 @@
1
- # Class: postgresql::java
2
- #
3
- # This class installs the postgresql jdbc connector.
4
- #
5
- # Parameters:
6
- # [*package_name*] - The name of the postgresql java package.
7
- # [*package_ensure*] - The ensure value of the package.
8
- #
9
- # Actions:
10
- #
11
- # Requires:
12
- #
13
- # Sample Usage:
14
- #
15
- # class { 'postgresql::java': }
16
- #
17
- class postgresql::java (
18
- $package_name = $postgresql::params::java_package_name,
19
- $package_ensure = 'present'
20
- ) inherits postgresql::params {
21
-
22
- validate_string($package_name)
23
-
24
- package { 'postgresql-jdbc':
25
- ensure => $package_ensure,
26
- name => $package_name,
27
- }
28
-
29
- }
@@ -1,21 +0,0 @@
1
- class postgresql::package_source::apt_postgresql_org {
2
- # Here we have tried to replicate the instructions on the PostgreSQL site:
3
- #
4
- # http://www.postgresql.org/download/linux/debian/
5
- #
6
- apt::pin { 'apt.postgresql.org':
7
- originator => 'apt.postgresql.org',
8
- priority => 500,
9
- }->
10
- apt::source { 'apt.postgresql.org':
11
- location => 'http://apt.postgresql.org/pub/repos/apt/',
12
- release => "${::lsbdistcodename}-pgdg",
13
- repos => 'main',
14
- required_packages => 'pgdg-keyring',
15
- key => 'ACCC4CF8',
16
- key_source => 'http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc',
17
- include_src => false,
18
- }
19
-
20
- Apt::Source['apt.postgresql.org']->Package<|tag == 'postgresql'|>
21
- }
@@ -1,30 +0,0 @@
1
- class postgresql::package_source::yum_postgresql_org(
2
- $version
3
- ) {
4
-
5
- $version_parts = split($version, '[.]')
6
- $package_version = "${version_parts[0]}${version_parts[1]}"
7
-
8
- file { "/etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-${package_version}":
9
- source => 'puppet:///modules/postgresql/RPM-GPG-KEY-PGDG',
10
- before => Yumrepo['yum.postgresql.org']
11
- }
12
-
13
- if($::operatingsystem == 'Fedora') {
14
- $label1 = 'fedora'
15
- $label2 = $label1
16
- } else {
17
- $label1 = 'redhat'
18
- $label2 = 'rhel'
19
- }
20
-
21
- yumrepo { 'yum.postgresql.org':
22
- descr => "PostgreSQL ${version} \$releasever - \$basearch",
23
- baseurl => "http://yum.postgresql.org/${version}/${label1}/${label2}-\$releasever-\$basearch",
24
- enabled => 1,
25
- gpgcheck => 1,
26
- gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-${package_version}",
27
- }
28
-
29
- Yumrepo['yum.postgresql.org'] -> Package<|tag == 'postgresql'|>
30
- }
@@ -1,19 +0,0 @@
1
- # This resource manages a pg_hba file, collecting fragments of pg_hba_rules
2
- # to build up the final file.
3
- define postgresql::pg_hba(
4
- $target = $postgresql::params::pg_hba_conf_path,
5
- $owner = 0,
6
- $group = $postgresql::params::group
7
- ) {
8
- include postgresql::params
9
- include concat::setup
10
-
11
- # Collect file from fragments
12
- concat { $target:
13
- owner => $owner,
14
- group => $group,
15
- mode => '0640',
16
- warn => true,
17
- }
18
-
19
- }
@@ -1,41 +0,0 @@
1
- # This resource manages an individual rule that applies to the file defined in
2
- # $target.
3
- define postgresql::pg_hba_rule(
4
- $type,
5
- $database,
6
- $user,
7
- $auth_method,
8
- $address = undef,
9
- $description = 'none',
10
- $auth_option = undef,
11
- $target = $postgresql::params::pg_hba_conf_path,
12
- $order = '150'
13
- ) {
14
- include postgresql::params
15
-
16
- validate_re($type, '^(local|host|hostssl|hostnossl)$',
17
- "The type you specified [${type}] must be one of: local, host, hostssl, hostnosssl")
18
- validate_re($auth_method, '^(trust|reject|md5|crypt|password|gss|sspi|krb5|ident|peer|ldap|radius|cert|pam)$',
19
- "The auth_method you specified [${auth_method}] must be one of: trust, reject, md5, crypt, password, krb5, ident, ldap, pam")
20
-
21
- if($type =~ /^host/ and $address == undef) {
22
- fail('You must specify an address property when type is host based')
23
- }
24
-
25
- # This is required to make sure concat::setup is initialized first. This
26
- # probably points to a bug inside ripienaar-concat.
27
- include concat::setup
28
-
29
- # Create a rule fragment
30
- $fragname = "pg_hba_rule_${name}"
31
- concat::fragment { $fragname:
32
- target => $target,
33
- content => template('postgresql/pg_hba_rule.conf'),
34
- order => $order,
35
- owner => $::id,
36
- mode => '0600',
37
- }
38
-
39
- Class['concat::setup']->
40
- Concat::Fragment[$fragname]
41
- }
@@ -1,24 +0,0 @@
1
- # == Class: postgresql::plperl
2
- #
3
- # This class installs the PL/Perl procedural language for postgresql.
4
- #
5
- # === Parameters
6
- #
7
- # [*package_name*]
8
- # name of package
9
- #
10
- # [*package_ensure*]
11
- # ensure state for package.
12
- # can be specified as version.
13
- #
14
- class postgresql::plperl(
15
- $package_name = $postgresql::params::plperl_package_name,
16
- $package_ensure = 'present'
17
- ) inherits postgresql::params {
18
-
19
- package { 'postgresql-plperl':
20
- ensure => $package_ensure,
21
- name => $package_name,
22
- }
23
-
24
- }
@@ -1,56 +0,0 @@
1
- # puppet-postgresql
2
- # For all details and documentation:
3
- # http://github.com/inkling/puppet-postgresql
4
- #
5
- # Copyright 2012- Inkling Systems, 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
- define postgresql::psql(
20
- $db,
21
- $unless,
22
- $command = $title,
23
- $refreshonly = false,
24
- $user = $postgresql::params::user
25
- ) {
26
-
27
- include postgresql::params
28
-
29
- # TODO: FIXME: shellquote does not work, and this regex works for trivial
30
- # things but not nested escaping. Need a lexer, preferably a ruby SQL parser
31
- # to catch errors at catalog time. Possibly https://github.com/omghax/sql ?
32
-
33
- if ($postgresql::params::version != '8.1') {
34
- $no_password_option = '--no-password'
35
- }
36
-
37
- $psql = "${postgresql::params::psql_path} ${no_password_option} --tuples-only --quiet --dbname ${db}"
38
-
39
- $quoted_command = regsubst($command, '"', '\\"', 'G')
40
- $quoted_unless = regsubst($unless, '"', '\\"', 'G')
41
-
42
- $final_cmd = "/bin/echo \"${quoted_command}\" | ${psql} |egrep -v -q '^$'"
43
-
44
- notify { "deprecation warning: ${final_cmd}":
45
- message => 'postgresql::psql is deprecated ; please use postgresql_psql instead.',
46
- } ->
47
-
48
- exec { $final_cmd:
49
- cwd => '/tmp',
50
- user => $user,
51
- returns => 1,
52
- unless => "/bin/echo \"${quoted_unless}\" | ${psql} | egrep -v -q '^$'",
53
- refreshonly => $refreshonly,
54
- }
55
- }
56
-
@@ -1,18 +0,0 @@
1
- # Class: postgresql::python
2
- # This class installs the python libs for postgresql.
3
- #
4
- # Parameters:
5
- # [*ensure*] - ensure state for package.
6
- # can be specified as version.
7
- # [*package_name*] - name of package
8
- class postgresql::python(
9
- $package_name = $postgresql::params::python_package_name,
10
- $package_ensure = 'present'
11
- ) inherits postgresql::params {
12
-
13
- package { 'python-psycopg2':
14
- ensure => $package_ensure,
15
- name => $package_name,
16
- }
17
-
18
- }