diff options
Diffstat (limited to '')
-rw-r--r-- | manifests/instance.pp | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/manifests/instance.pp b/manifests/instance.pp index adaa30d..07db874 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -1,99 +1,99 @@ define blog::instance ( - String $blog_title = $name, String $author, + String $blog_title = $name, Boolean $has_comments = false, + String $engine_version = '8.0', String $subtitle = '', - Optional[String] $vcs_repo = undef, + Optional[Struct[{ url => String, ref => String}]] $vcs_repo = undef, ) { $root = "${blog::blog_root}/${title}" $safe_title = base64('encode', $blog_title) + # Download source vcsrepo { $root: - ensure => latest, + ensure => latest, provider => git, - source => 'https://github.com/HugoNikanor/website-blog-2.git', - revision => 'master', + source => 'https://github.com/HugoNikanor/website-blog-2.git', + revision => $engine_version, + group => 'www-data', # keep_local_changes => true, - owner => 'hugo', - group => 'www-data', } + # Manage entries directory if $vcs_repo { vcsrepo { "${root}/entries": - ensure => latest, + ensure => latest, provider => git, - source => $vcs_repo, - revision => 'master', - owner => 'hugo', - group => 'www-data', - } - } else { - file { "${root}/entries": - ensure => directory, - } - } - - file { "${root}/settings.php": - ensure => file, - content => epp('blog/settings.php.epp', { - author => $author, - title => $title, - subtitle => $subtitle, - has_comments => $has_comments, - }), + source => $vcs_repo['url'], + revision => $vcs_repo['ref'], + group => 'www-data', } - - file { "${root}/footnote": + } else { + file { "${root}/entries": ensure => directory, - recurse => true, } + } - $foot_files = [ - ['about.md', 'About'], - ['contact.md', 'Contact'], - ['legal.md', 'Legal'], - ['qna.md', '"Q&A"'], - ] + file { "${root}/settings.php": + ensure => file, + content => epp('blog/settings.php.epp', { + author => $author, + title => $blog_title, + subtitle => $subtitle, + has_comments => $has_comments, + }), + } - $foot_files.each |$item| { - file { "${root}/footnote/${item[0]}": - source => "puppet:///modules/blog/footers/${item[0]}", - } - } + file { "${root}/footnote": + ensure => directory, + recurse => true, + } - file { "${root}/special-files.ini": - ensure => file, - content => $foot_files, - } + $foot_files = [ + ['about.md', 'About'], + ['contact.md', 'Contact'], + ['legal.md', 'Legal'], + ['qna.md', '"Q&A"'], + ] - $certname = lookup('certname') + $foot_files.each |$item| { + file { "${root}/footnote/${item[0]}": + source => "puppet:///modules/blog/footers/${item[0]}", + } + } - if $blog::domain { + file { "${root}/special-files.ini": + ensure => file, + content => epp( + 'blog/special-files.ini.epp', + { foot_files => $foot_files, }), + } - nginx::resource::location { "${safe_title} - server - /": - location => '/', - try_files => ['$uri', '$uri/', '=404'], - index_files => [], - ssl => true, - autoindex => on, - server => [ "${safe_title} - server", ] - } + nginx::resource::location { "${safe_title} - /": + location => '/', + try_files => ['$uri', '$uri/', '=404'], + index_files => [], + ssl => true, + ssl_only => true, + autoindex => on, + server => $blog::blog_server_name, + } - nginx::resource::location { "${safe_title} - server - php": - location => '~ \.php$', - fastcgi_params => 'snippets/fastcgi-php.conf', - fastcgi => 'unix:/run/php/php-fpm.sock', - ssl => true, - server => [ "${safe_title} - server", ], - } + nginx::resource::location { "${safe_title} - php": + location => '~ \.php$', + fastcgi_params => 'snippets/fastcgi-php.conf', + fastcgi => 'unix:/run/php/php-fpm.sock', + ssl => true, + ssl_only => true, + server => $blog::blog_server_name, + } - nginx::resource::location { "${safe_title} - server - ht": - location => '~ /\.ht', - location_cfg_append => { deny => 'all' }, - index_files => [], - ssl => true, - server => [ "${safe_title} - server", ], - } - } + nginx::resource::location { "${safe_title} - ht": + location => '~ /\.ht', + location_cfg_append => { deny => 'all' }, + index_files => [], + ssl => true, + server => $blog::blog_server_name, + } } |