init.pp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. # All in one class for setting up a PuppetDB instance. See README.md for more
  2. # details.
  3. class puppetdb (
  4. $listen_address = $puppetdb::params::listen_address,
  5. $listen_port = $puppetdb::params::listen_port,
  6. $disable_cleartext = $puppetdb::params::disable_cleartext,
  7. $open_listen_port = $puppetdb::params::open_listen_port,
  8. $ssl_listen_address = $puppetdb::params::ssl_listen_address,
  9. $ssl_listen_port = $puppetdb::params::ssl_listen_port,
  10. $disable_ssl = $puppetdb::params::disable_ssl,
  11. $open_ssl_listen_port = $puppetdb::params::open_ssl_listen_port,
  12. $ssl_dir = $puppetdb::params::ssl_dir,
  13. $ssl_set_cert_paths = $puppetdb::params::ssl_set_cert_paths,
  14. $ssl_cert_path = $puppetdb::params::ssl_cert_path,
  15. $ssl_key_path = $puppetdb::params::ssl_key_path,
  16. $ssl_ca_cert_path = $puppetdb::params::ssl_ca_cert_path,
  17. $ssl_deploy_certs = $puppetdb::params::ssl_deploy_certs,
  18. $ssl_key = $puppetdb::params::ssl_key,
  19. $ssl_cert = $puppetdb::params::ssl_cert,
  20. $ssl_ca_cert = $puppetdb::params::ssl_ca_cert,
  21. $ssl_protocols = $puppetdb::params::ssl_protocols,
  22. $manage_dbserver = $puppetdb::params::manage_dbserver,
  23. $manage_package_repo = $puppetdb::params::manage_pg_repo,
  24. $postgres_version = $puppetdb::params::postgres_version,
  25. $database = $puppetdb::params::database,
  26. $database_host = $puppetdb::params::database_host,
  27. $database_port = $puppetdb::params::database_port,
  28. $database_username = $puppetdb::params::database_username,
  29. $database_password = $puppetdb::params::database_password,
  30. $database_name = $puppetdb::params::database_name,
  31. $database_ssl = $puppetdb::params::database_ssl,
  32. $jdbc_ssl_properties = $puppetdb::params::jdbc_ssl_properties,
  33. $database_listen_address = $puppetdb::params::postgres_listen_addresses,
  34. $database_validate = $puppetdb::params::database_validate,
  35. $database_embedded_path = $puppetdb::params::database_embedded_path,
  36. $node_ttl = $puppetdb::params::node_ttl,
  37. $node_purge_ttl = $puppetdb::params::node_purge_ttl,
  38. $report_ttl = $puppetdb::params::report_ttl,
  39. $gc_interval = $puppetdb::params::gc_interval,
  40. $log_slow_statements = $puppetdb::params::log_slow_statements,
  41. $conn_max_age = $puppetdb::params::conn_max_age,
  42. $conn_keep_alive = $puppetdb::params::conn_keep_alive,
  43. $conn_lifetime = $puppetdb::params::conn_lifetime,
  44. $puppetdb_package = $puppetdb::params::puppetdb_package,
  45. $puppetdb_service = $puppetdb::params::puppetdb_service,
  46. $puppetdb_service_status = $puppetdb::params::puppetdb_service_status,
  47. $puppetdb_user = $puppetdb::params::puppetdb_user,
  48. $puppetdb_group = $puppetdb::params::puppetdb_group,
  49. $read_database = $puppetdb::params::read_database,
  50. $read_database_host = $puppetdb::params::read_database_host,
  51. $read_database_port = $puppetdb::params::read_database_port,
  52. $read_database_username = $puppetdb::params::read_database_username,
  53. $read_database_password = $puppetdb::params::read_database_password,
  54. $read_database_name = $puppetdb::params::read_database_name,
  55. $read_database_ssl = $puppetdb::params::read_database_ssl,
  56. $read_database_jdbc_ssl_properties = $puppetdb::params::read_database_jdbc_ssl_properties,
  57. $read_database_validate = $puppetdb::params::read_database_validate,
  58. $read_log_slow_statements = $puppetdb::params::read_log_slow_statements,
  59. $read_conn_max_age = $puppetdb::params::read_conn_max_age,
  60. $read_conn_keep_alive = $puppetdb::params::read_conn_keep_alive,
  61. $read_conn_lifetime = $puppetdb::params::read_conn_lifetime,
  62. $confdir = $puppetdb::params::confdir,
  63. $vardir = $puppetdb::params::vardir,
  64. $manage_firewall = $puppetdb::params::manage_firewall,
  65. $java_args = $puppetdb::params::java_args,
  66. $merge_default_java_args = $puppetdb::params::merge_default_java_args,
  67. $max_threads = $puppetdb::params::max_threads,
  68. $command_threads = $puppetdb::params::command_threads,
  69. $store_usage = $puppetdb::params::store_usage,
  70. $temp_usage = $puppetdb::params::temp_usage,
  71. $certificate_whitelist_file = $puppetdb::params::certificate_whitelist_file,
  72. $certificate_whitelist = $puppetdb::params::certificate_whitelist,
  73. $database_max_pool_size = $puppetdb::params::database_max_pool_size,
  74. $read_database_max_pool_size = $puppetdb::params::read_database_max_pool_size,
  75. ) inherits puppetdb::params {
  76. class { '::puppetdb::server':
  77. listen_address => $listen_address,
  78. listen_port => $listen_port,
  79. disable_cleartext => $disable_cleartext,
  80. open_listen_port => $open_listen_port,
  81. ssl_listen_address => $ssl_listen_address,
  82. ssl_listen_port => $ssl_listen_port,
  83. disable_ssl => $disable_ssl,
  84. open_ssl_listen_port => $open_ssl_listen_port,
  85. ssl_dir => $ssl_dir,
  86. ssl_set_cert_paths => $ssl_set_cert_paths,
  87. ssl_cert_path => $ssl_cert_path,
  88. ssl_key_path => $ssl_key_path,
  89. ssl_ca_cert_path => $ssl_ca_cert_path,
  90. ssl_deploy_certs => $ssl_deploy_certs,
  91. ssl_key => $ssl_key,
  92. ssl_cert => $ssl_cert,
  93. ssl_ca_cert => $ssl_ca_cert,
  94. ssl_protocols => $ssl_protocols,
  95. database => $database,
  96. database_host => $database_host,
  97. database_port => $database_port,
  98. database_username => $database_username,
  99. database_password => $database_password,
  100. database_name => $database_name,
  101. database_ssl => $database_ssl,
  102. jdbc_ssl_properties => $jdbc_ssl_properties,
  103. database_validate => $database_validate,
  104. database_embedded_path => $database_embedded_path,
  105. node_ttl => $node_ttl,
  106. node_purge_ttl => $node_purge_ttl,
  107. report_ttl => $report_ttl,
  108. gc_interval => $gc_interval,
  109. log_slow_statements => $log_slow_statements,
  110. conn_max_age => $conn_max_age,
  111. conn_keep_alive => $conn_keep_alive,
  112. conn_lifetime => $conn_lifetime,
  113. puppetdb_package => $puppetdb_package,
  114. puppetdb_service => $puppetdb_service,
  115. puppetdb_service_status => $puppetdb_service_status,
  116. confdir => $confdir,
  117. vardir => $vardir,
  118. java_args => $java_args,
  119. merge_default_java_args => $merge_default_java_args,
  120. max_threads => $max_threads,
  121. read_database => $read_database,
  122. read_database_host => $read_database_host,
  123. read_database_port => $read_database_port,
  124. read_database_username => $read_database_username,
  125. read_database_password => $read_database_password,
  126. read_database_name => $read_database_name,
  127. read_database_ssl => $read_database_ssl,
  128. read_database_jdbc_ssl_properties => $read_database_jdbc_ssl_properties,
  129. read_database_validate => $read_database_validate,
  130. read_log_slow_statements => $read_log_slow_statements,
  131. read_conn_max_age => $read_conn_max_age,
  132. read_conn_keep_alive => $read_conn_keep_alive,
  133. read_conn_lifetime => $read_conn_lifetime,
  134. puppetdb_user => $puppetdb_user,
  135. puppetdb_group => $puppetdb_group,
  136. manage_firewall => $manage_firewall,
  137. command_threads => $command_threads,
  138. store_usage => $store_usage,
  139. temp_usage => $temp_usage,
  140. certificate_whitelist_file => $certificate_whitelist_file,
  141. certificate_whitelist => $certificate_whitelist,
  142. database_max_pool_size => $database_max_pool_size,
  143. read_database_max_pool_size => $read_database_max_pool_size,
  144. }
  145. if ($database == 'postgres') {
  146. $database_before = str2bool($database_validate) ? {
  147. false => Class['::puppetdb::server'],
  148. default => [Class['::puppetdb::server'],
  149. Class['::puppetdb::server::validate_db']],
  150. }
  151. class { '::puppetdb::database::postgresql':
  152. listen_addresses => $database_listen_address,
  153. database_name => $database_name,
  154. database_username => $database_username,
  155. database_password => $database_password,
  156. database_port => $database_port,
  157. manage_server => $manage_dbserver,
  158. manage_package_repo => $manage_package_repo,
  159. postgres_version => $postgres_version,
  160. before => $database_before
  161. }
  162. }
  163. }