diff --git a/manifests/master/puppetdb_conf.pp b/manifests/master/puppetdb_conf.pp index a3dd72fc..f07739b3 100644 --- a/manifests/master/puppetdb_conf.pp +++ b/manifests/master/puppetdb_conf.pp @@ -14,7 +14,7 @@ }, ) inherits puppetdb::params { - Ini_setting { + $ini_setting_defaults = { ensure => present, section => 'main', path => "${puppet_confdir}/puppetdb.conf", @@ -24,20 +24,24 @@ ini_setting { 'puppetdbserver': setting => 'server', value => $server, + * => $ini_setting_defaults, } ini_setting { 'puppetdbport': setting => 'port', value => $port, + * => $ini_setting_defaults, } } else { ini_setting { 'puppetdbserver_urls': setting => 'server_urls', value => "https://${server}:${port}/", + * => $ini_setting_defaults, } } ini_setting { 'soft_write_failure': setting => 'soft_write_failure', value => $soft_write_failure, + * => $ini_setting_defaults, } } diff --git a/manifests/master/storeconfigs.pp b/manifests/master/storeconfigs.pp index cb46cc09..1e8d6822 100644 --- a/manifests/master/storeconfigs.pp +++ b/manifests/master/storeconfigs.pp @@ -17,7 +17,7 @@ default => absent, } - Ini_setting { + $ini_setting_defaults = { section => $puppet_conf_section, path => $puppet_conf, ensure => $storeconfigs_ensure, @@ -26,10 +26,12 @@ ini_setting { "puppet.conf/${puppet_conf_section}/storeconfigs": setting => 'storeconfigs', value => true, + * => $ini_setting_defaults, } ini_setting { "puppet.conf/${puppet_conf_section}/storeconfigs_backend": setting => 'storeconfigs_backend', value => 'puppetdb', + * => $ini_setting_defaults, } } diff --git a/manifests/server/command_processing.pp b/manifests/server/command_processing.pp index 6d05e562..8f39f531 100644 --- a/manifests/server/command_processing.pp +++ b/manifests/server/command_processing.pp @@ -10,58 +10,69 @@ $config_ini = "${confdir}/config.ini" # Set the defaults - Ini_setting { + $ini_setting_defaults = { path => $config_ini, - ensure => 'present', section => 'command-processing', require => File[$config_ini], } if $command_threads { ini_setting { 'puppetdb_command_processing_threads': + ensure => 'present', setting => 'threads', value => $command_threads, + * => $ini_setting_defaults, } } else { ini_setting { 'puppetdb_command_processing_threads': ensure => 'absent', setting => 'threads', + * => $ini_setting_defaults, } } if $concurrent_writes { ini_setting { 'puppetdb_command_processing_concurrent_writes': + ensure => 'present', setting => 'concurrent-writes', value => $concurrent_writes, + * => $ini_setting_defaults, } } else { ini_setting { 'puppetdb_command_processing_concurrent_writes': ensure => 'absent', setting => 'concurrent-writes', + * => $ini_setting_defaults, } } if $store_usage { ini_setting { 'puppetdb_command_processing_store_usage': + ensure => 'present', setting => 'store-usage', value => $store_usage, + * => $ini_setting_defaults, } } else { ini_setting { 'puppetdb_command_processing_store_usage': ensure => 'absent', setting => 'store-usage', + * => $ini_setting_defaults, } } if $temp_usage { ini_setting { 'puppetdb_command_processing_temp_usage': + ensure => 'present', setting => 'temp-usage', value => $temp_usage, + * => $ini_setting_defaults, } } else { ini_setting { 'puppetdb_command_processing_temp_usage': ensure => 'absent', setting => 'temp-usage', + * => $ini_setting_defaults, } } } diff --git a/manifests/server/database.pp b/manifests/server/database.pp index 12dff9ff..74b06189 100644 --- a/manifests/server/database.pp +++ b/manifests/server/database.pp @@ -65,9 +65,8 @@ default => [$file_require, Class['puppetdb::server::validate_db']], } # Set the defaults - Ini_setting { + $ini_setting_defaults = { path => $database_ini, - ensure => present, section => 'database', require => $ini_setting_require } @@ -109,98 +108,99 @@ ##Only setup for postgres ini_setting { 'puppetdb_psdatabase_username': + ensure => present, setting => 'username', value => $database_username, + * => $ini_setting_defaults, } if $database_password != undef and $manage_db_password { ini_setting { 'puppetdb_psdatabase_password': + ensure => present, setting => 'password', value => $database_password, + * => $ini_setting_defaults, } } } - ini_setting { 'puppetdb_classname': - setting => 'classname', - value => $classname, + ini_setting{ + default: + ensure => present, + * => $ini_setting_defaults, + ; + 'puppetdb_classname': + setting => 'classname', + value => $classname, + ; + 'puppetdb_subprotocol': + setting => 'subprotocol', + value => $subprotocol, + ; + 'puppetdb_pgs': + setting => 'syntax_pgs', + value => true, + ; + 'puppetdb_subname': + setting => 'subname', + value => $subname, + ; + 'puppetdb_gc_interval': + setting => 'gc-interval', + value => $gc_interval, + ; + 'puppetdb_node_purge_gc_batch_limit': + setting => 'node-purge-gc-batch-limit', + value => $node_purge_gc_batch_limit, + ; + 'puppetdb_node_ttl': + setting => 'node-ttl', + value => $node_ttl, + ; + 'puppetdb_node_purge_ttl': + setting => 'node-purge-ttl', + value => $node_purge_ttl, + ; + 'puppetdb_report_ttl': + setting => 'report-ttl', + value => $report_ttl, + ; + 'puppetdb_log_slow_statements': + setting => 'log-slow-statements', + value => $log_slow_statements, + ; + 'puppetdb_conn_max_age': + setting => 'conn-max-age', + value => $conn_max_age, + ; + 'puppetdb_conn_keep_alive': + setting => 'conn-keep-alive', + value => $conn_keep_alive, + ; + 'puppetdb_conn_lifetime': + setting => 'conn-lifetime', + value => $conn_lifetime, + ; + 'puppetdb_migrate': + setting => 'migrate', + value => $migrate, + ; } - ini_setting { 'puppetdb_subprotocol': - setting => 'subprotocol', - value => $subprotocol, - } - - ini_setting { 'puppetdb_pgs': - setting => 'syntax_pgs', - value => true, - } - - ini_setting { 'puppetdb_subname': - setting => 'subname', - value => $subname, - } - - ini_setting { 'puppetdb_gc_interval': - setting => 'gc-interval', - value => $gc_interval, - } - - ini_setting { 'puppetdb_node_purge_gc_batch_limit': - setting => 'node-purge-gc-batch-limit', - value => $node_purge_gc_batch_limit, - } - - ini_setting { 'puppetdb_node_ttl': - setting => 'node-ttl', - value => $node_ttl, - } - - ini_setting { 'puppetdb_node_purge_ttl': - setting => 'node-purge-ttl', - value => $node_purge_ttl, - } - - ini_setting { 'puppetdb_report_ttl': - setting => 'report-ttl', - value => $report_ttl, - } - - ini_setting { 'puppetdb_log_slow_statements': - setting => 'log-slow-statements', - value => $log_slow_statements, - } - - ini_setting { 'puppetdb_conn_max_age': - setting => 'conn-max-age', - value => $conn_max_age, - } - - ini_setting { 'puppetdb_conn_keep_alive': - setting => 'conn-keep-alive', - value => $conn_keep_alive, - } - - ini_setting { 'puppetdb_conn_lifetime': - setting => 'conn-lifetime', - value => $conn_lifetime, - } - - ini_setting { 'puppetdb_migrate': - setting => 'migrate', - value => $migrate, - } if $puppetdb::params::database_max_pool_size_setting_name != undef { if $database_max_pool_size == 'absent' { ini_setting { 'puppetdb_database_max_pool_size': ensure => absent, setting => $puppetdb::params::database_max_pool_size_setting_name, + * => $ini_setting_defaults, } } elsif $database_max_pool_size != undef { ini_setting { 'puppetdb_database_max_pool_size': + ensure => present, setting => $puppetdb::params::database_max_pool_size_setting_name, value => $database_max_pool_size, + * => $ini_setting_defaults, } } } @@ -208,13 +208,16 @@ if ($facts_blacklist) and length($facts_blacklist) != 0 { $joined_facts_blacklist = join($facts_blacklist, ', ') ini_setting { 'puppetdb_facts_blacklist': + ensure => present, setting => 'facts-blacklist', value => $joined_facts_blacklist, + * => $ini_setting_defaults, } } else { ini_setting { 'puppetdb_facts_blacklist': ensure => absent, setting => 'facts-blacklist', + * => $ini_setting_defaults, } } } diff --git a/manifests/server/global.pp b/manifests/server/global.pp index 4afcc62f..9addb685 100644 --- a/manifests/server/global.pp +++ b/manifests/server/global.pp @@ -16,17 +16,18 @@ } # Set the defaults - Ini_setting { + $ini_setting_defaults = { path => $config_ini, - ensure => 'present', section => 'global', require => File[$config_ini], } if $vardir { ini_setting { 'puppetdb_global_vardir': + ensure => present, setting => 'vardir', value => $vardir, + * => $ini_setting_defaults, } } } diff --git a/manifests/server/jetty.pp b/manifests/server/jetty.pp index ea050faf..3e75194e 100644 --- a/manifests/server/jetty.pp +++ b/manifests/server/jetty.pp @@ -28,9 +28,8 @@ } # Set the defaults - Ini_setting { + $ini_setting_defaults = { path => $jetty_ini, - ensure => present, section => 'jetty', require => File[$jetty_ini], } @@ -40,33 +39,35 @@ default => 'present', } - ini_setting { 'puppetdb_host': - ensure => $cleartext_setting_ensure, - setting => 'host', - value => $listen_address, - } - - ini_setting { 'puppetdb_port': - ensure => $cleartext_setting_ensure, - setting => 'port', - value => $listen_port, - } - $ssl_setting_ensure = $disable_ssl ? { true => 'absent', default => 'present', } - ini_setting { 'puppetdb_sslhost': - ensure => $ssl_setting_ensure, - setting => 'ssl-host', - value => $ssl_listen_address, - } - - ini_setting { 'puppetdb_sslport': - ensure => $ssl_setting_ensure, - setting => 'ssl-port', - value => $ssl_listen_port, + ini_setting { + default: + * => $ini_setting_defaults, + ; + 'puppetdb_host': + ensure => $cleartext_setting_ensure, + setting => 'host', + value => $listen_address, + ; + 'puppetdb_port': + ensure => $cleartext_setting_ensure, + setting => 'port', + value => $listen_port, + ; + 'puppetdb_sslhost': + ensure => $ssl_setting_ensure, + setting => 'ssl-host', + value => $ssl_listen_address, + ; + 'puppetdb_sslport': + ensure => $ssl_setting_ensure, + setting => 'ssl-port', + value => $ssl_listen_port, + ; } if $ssl_protocols { @@ -75,6 +76,7 @@ ensure => $ssl_setting_ensure, setting => 'ssl-protocols', value => $ssl_protocols, + * => $ini_setting_defaults, } } @@ -84,37 +86,45 @@ ensure => $ssl_setting_ensure, setting => 'cipher-suites', value => $cipher_suites, + * => $ini_setting_defaults, } } if $ssl_set_cert_paths { # assume paths have been validated in calling class - ini_setting { 'puppetdb_ssl_key': - ensure => present, - setting => 'ssl-key', - value => $ssl_key_path, - } - ini_setting { 'puppetdb_ssl_cert': - ensure => present, - setting => 'ssl-cert', - value => $ssl_cert_path, - } - ini_setting { 'puppetdb_ssl_ca_cert': - ensure => present, - setting => 'ssl-ca-cert', - value => $ssl_ca_cert_path, + # + ini_setting { + default: + ensure => present, + * => $ini_setting_defaults, + ; + 'puppetdb_ssl_key': + setting => 'ssl-key', + value => $ssl_key_path, + ; + 'puppetdb_ssl_cert': + setting => 'ssl-cert', + value => $ssl_cert_path, + ; + 'puppetdb_ssl_ca_cert': + setting => 'ssl-ca-cert', + value => $ssl_ca_cert_path, + ; } } if ($max_threads) { ini_setting { 'puppetdb_max_threads': + ensure => present, setting => 'max-threads', value => $max_threads, + * => $ini_setting_defaults, } } else { ini_setting { 'puppetdb_max_threads': ensure => absent, setting => 'max-threads', + * => $ini_setting_defaults, } } } diff --git a/manifests/server/puppetdb.pp b/manifests/server/puppetdb.pp index 54fa4d2d..15afabb5 100644 --- a/manifests/server/puppetdb.pp +++ b/manifests/server/puppetdb.pp @@ -18,16 +18,15 @@ } # Set the defaults - Ini_setting { + $ini_setting_defaults = { path => $puppetdb_ini, - ensure => present, section => 'puppetdb', require => File[$puppetdb_ini], } $certificate_whitelist_setting_ensure = empty($certificate_whitelist) ? { - true => 'absent', - default => 'present', + true => absent, + default => present, } # accept connections only from puppet master @@ -36,6 +35,7 @@ section => 'puppetdb', setting => 'certificate-whitelist', value => $certificate_whitelist_file, + * => $ini_setting_defaults, } file { $certificate_whitelist_file: @@ -48,13 +48,16 @@ if $disable_update_checking { ini_setting { 'puppetdb_disable_update_checking': + ensure => present, setting => 'disable-update-checking', value => $disable_update_checking, + * => $ini_setting_defaults, } } else { ini_setting { 'puppetdb_disable_update_checking': - ensure => 'absent', + ensure => absent, setting => 'disable-update-checking', + * => $ini_setting_defaults, } } } diff --git a/manifests/server/read_database.pp b/manifests/server/read_database.pp index 688a74fe..f50f6a81 100644 --- a/manifests/server/read_database.pp +++ b/manifests/server/read_database.pp @@ -58,9 +58,8 @@ default => [$file_require, Class['puppetdb::server::validate_read_db']], } # Set the defaults - Ini_setting { + $ini_setting_defaults = { path => $read_database_ini, - ensure => present, section => 'read-database', require => $ini_setting_require, } @@ -95,68 +94,75 @@ } ini_setting { 'puppetdb_read_database_username': + ensure => present, setting => 'username', value => $read_database_username, + * => $ini_setting_defaults, } if $read_database_password != undef and $manage_db_password { ini_setting { 'puppetdb_read_database_password': + ensure => present, setting => 'password', value => $read_database_password, + * => $ini_setting_defaults, } } } - ini_setting { 'puppetdb_read_classname': - setting => 'classname', - value => $classname, + ini_setting { + default: + ensure => present, + * => $ini_setting_defaults, + ; + 'puppetdb_read_classname': + setting => 'classname', + value => $classname, + ; + 'puppetdb_read_subprotocol': + setting => 'subprotocol', + value => $subprotocol, + ; + 'puppetdb_read_pgs': + setting => 'syntax_pgs', + value => true, + ; + 'puppetdb_read_subname': + setting => 'subname', + value => $subname, + ; + 'puppetdb_read_log_slow_statements': + setting => 'log-slow-statements', + value => $log_slow_statements, + ; + 'puppetdb_read_conn_max_age': + setting => 'conn-max-age', + value => $conn_max_age, + ; + 'puppetdb_read_conn_keep_alive': + setting => 'conn-keep-alive', + value => $conn_keep_alive, + ; + 'puppetdb_read_conn_lifetime': + setting => 'conn-lifetime', + value => $conn_lifetime, + ; } - ini_setting { 'puppetdb_read_subprotocol': - setting => 'subprotocol', - value => $subprotocol, - } - - ini_setting { 'puppetdb_read_pgs': - setting => 'syntax_pgs', - value => true, - } - - ini_setting { 'puppetdb_read_subname': - setting => 'subname', - value => $subname, - } - - ini_setting { 'puppetdb_read_log_slow_statements': - setting => 'log-slow-statements', - value => $log_slow_statements, - } - - ini_setting { 'puppetdb_read_conn_max_age': - setting => 'conn-max-age', - value => $conn_max_age, - } - - ini_setting { 'puppetdb_read_conn_keep_alive': - setting => 'conn-keep-alive', - value => $conn_keep_alive, - } - - ini_setting { 'puppetdb_read_conn_lifetime': - setting => 'conn-lifetime', - value => $conn_lifetime, - } if $puppetdb::params::database_max_pool_size_setting_name != undef { if $database_max_pool_size == 'absent' { ini_setting { 'puppetdb_read_database_max_pool_size': ensure => absent, setting => $puppetdb::params::database_max_pool_size_setting_name, + * => $ini_setting_defaults, } } elsif $database_max_pool_size != undef { ini_setting { 'puppetdb_read_database_max_pool_size': + ensure => present, setting => $puppetdb::params::database_max_pool_size_setting_name, value => $database_max_pool_size, + * => $ini_setting_defaults, } } } else {