OLD | NEW |
(Empty) | |
| 1 # == Class: adblockplus::web::static |
| 2 # |
| 3 # Manage a simple Nginx-based webserver for static content |
| 4 # that uses a customizable deployment script to e.g. fetch the content |
| 5 # from a repository server (ref. http://hub.eyeo.com/issues/4523) |
| 6 # |
| 7 # |
| 8 # === Parameters: |
| 9 # |
| 10 # [*domain*] |
| 11 # The domain name for the website. |
| 12 # |
| 13 # [*ssl_certificate*] |
| 14 # The name of the SSL certificate file within modules/private/files, if any. |
| 15 # Requires a private_key as well. |
| 16 # |
| 17 # [*ssl_private_key*] |
| 18 # The name of the private key file within modules/private/files, if any. |
| 19 # Requires a certificate as well. |
| 20 # |
| 21 # [*is_default*] |
| 22 # Passed on to nginx (whether or not the site config should be default). |
| 23 # |
| 24 # [*ensure*] |
| 25 # Whether to set up the website or not. |
| 26 # |
| 27 # === Examples: |
| 28 # |
| 29 # class {'adblockplus::web::static': |
| 30 # domain => 'help.eyeo.com', |
| 31 # } |
| 32 # |
| 33 class adblockplus::web::static ( |
| 34 $domain = undef, |
| 35 $ssl_certificate = undef, |
| 36 $ssl_private_key = undef, |
| 37 $is_default = true, |
| 38 $ensure = 'present', |
| 39 $deploy_user = 'web-deploy', |
| 40 $deploy_user_authorized_keys = undef, |
| 41 ) { |
| 42 |
| 43 include adblockplus::web |
| 44 include nginx |
| 45 include geoip |
| 46 include ssh |
| 47 |
| 48 file {"/var/www/$domain": |
| 49 ensure => ensure_directory_state($ensure), |
| 50 mode => '0775', |
| 51 owner => www-data, |
| 52 group => www-data, |
| 53 } |
| 54 |
| 55 nginx::hostconfig {$title: |
| 56 content => template('adblockplus/web/static.conf.erb'), |
| 57 certificate => $ssl_certificate, |
| 58 domain => $domain, |
| 59 is_default => $is_default, |
| 60 private_key => $ssl_private_key, |
| 61 log => "access_log_$domain", |
| 62 } |
| 63 |
| 64 adblockplus::user {$deploy_user: |
| 65 authorized_keys => $deploy_user_authorized_keys, |
| 66 ensure => $ensure, |
| 67 password_hash => '*', |
| 68 shell => '/bin/bash', |
| 69 groups => ['www-data'], |
| 70 } |
| 71 |
| 72 file {"/home/$deploy_user/deploy_script.sh": |
| 73 content => template('adblockplus/web/static_deploy_script.sh.erb'), |
| 74 ensure => $ensure, |
| 75 mode => '0755', |
| 76 owner => $deploy_user, |
| 77 } |
| 78 |
| 79 } |
OLD | NEW |