class reverse_proxy { contain reverse_proxy::install contain reverse_proxy::config contain reverse_proxy::service } class reverse_proxy::install { package { 'nginx': ensure => installed, } } define reverse_proxy::conf_file ( $dest_base, $source_base, $group = 'www-data', $owner = 'www-data', $mode = '0640', ) { file { "${dest_base}/${name}": source => "${source_base}/${name}", ensure => 'present', group => $group, owner => $owner, mode => $mode, notify => Service['nginx'], } } class reverse_proxy::config { $config_files = [ # Make our dirs first 'conf.d', 'cert', # Then we can populate them 'conf.d/fedi.amy.mov', 'conf.d/s3.amy.mov', 'conf.d/blog.amy.mov', 'conf.d/auth.amy.mov', 'conf.d/pg.amy.mov', 'conf.d/forge.amy.mov', 'conf.d/cloud.amy.mov', 'conf.d/secrets.amy.mov', 'conf.d/internal-s3.amy.mov', 'cert/cf.key', 'cert/cf.pem', 'nginx.conf' ] reverse_proxy::conf_file { $config_files: source_base => 'puppet:///modules/reverse_proxy', dest_base => '/etc/nginx' } } class reverse_proxy::service { service { 'nginx': ensure => running, enable => true, } }