diff --git a/manifests/config.pp b/manifests/config.pp index d052216..28a6ab4 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,64 +1,63 @@ # == Class hitch::config # # This class is called from hitch for service config. # # @api private class hitch::config ( Stdlib::Absolutepath $config_root, Stdlib::Absolutepath $config_file, Stdlib::Absolutepath $dhparams_file, Boolean $purge_config_root, String $file_owner, String $user, String $group, String $dhparams_content, String $write_proxy_v2, String $frontend, String $backend, String $ciphers, ) { file { $config_root: ensure => directory, recurse => true, purge => $purge_config_root, owner => $file_owner, group => $group, mode => '0750', } concat { $config_file: ensure => present, } if $dhparams_content { file { $dhparams_file: ensure => present, owner => $file_owner, group => $group, mode => '0640', content => $dhparams_content, } } else { exec { "${title} generate dhparams": path => '/usr/local/bin:/usr/bin:/bin', command => "openssl dhparam 2048 -out ${dhparams_file}", creates => $dhparams_file, } -> file { $dhparams_file: ensure => present, owner => $file_owner, group => $group, mode => '0640', } } concat::fragment { "${title} config": content => template('hitch/hitch.conf.erb'), target => $config_file, } - create_resources('hitch::domain', $::hitch::domains) } diff --git a/manifests/init.pp b/manifests/init.pp index 751cedb..a617a87 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,81 +1,87 @@ # Class: hitch # =========================== # # Full description of class hitch here. # # Parameters # ---------- # # @param package_name [String] # Package name for installing hitch. # # @param service_name [String] # Service name for the hitch service. # # @param user [String] # User running the service. # # @param group [String] # Group running the service. # # @param file_owner [String] # User owning the configuration files. Defaults to "root". # # @param dhparams_file [Stdlib::Absolutepath] # Path to file for Diffie-Hellman parameters, which are shared # by all domains. # # @param dhparams_content [Optional[String]] # Content for the DH parameter file. If unset, DH parameters will # be generated on the node, which may take a long time. # # @param config_root [Stdlib::Absolutepath] # Configuration root directory. Default: /etc/hitch/ # # @param purge_config_root [Boolean] # If true, will delete all unmanaged files from the config_root. # Defaults to false. # # @param frontend[String] # The listening frontend for hitch. class hitch ( String $package_name, String $service_name, String $user, String $group, String $file_owner, Stdlib::Absolutepath $config_file, Stdlib::Absolutepath $dhparams_file, Stdlib::Absolutepath $config_root, Boolean $purge_config_root, String $frontend, String $backend, String $write_proxy_v2, String $ciphers, Optional[Hash] $domains, Optional[String] $dhparams_content = undef, ) { class { '::hitch::install': package => $package_name } -> class { '::hitch::config': config_root => $config_root, config_file => $config_file, dhparams_file => $dhparams_file, dhparams_content => $dhparams_content, purge_config_root => $purge_config_root, file_owner => $file_owner, user => $user, group => $group, frontend => $frontend, backend => $backend, write_proxy_v2 => $write_proxy_v2, ciphers => $ciphers, } ~> class { '::hitch::service': service_name => $service_name, } -> Class['::hitch'] + + $domains.each |$domain_title, $domain_params| { + hitch::domain { $domain_title: + * => $domain_params + } + } }