| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 # == Class: adblockplus::web::static | 1 # == Class: adblockplus::web::static |
| 2 # | 2 # |
| 3 # Manage a simple Nginx-based webserver for static content | 3 # Manage a simple Nginx-based webserver for static content |
| 4 # that uses a customizable deployment script to e.g. fetch the 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) | 5 # from a repository server (ref. http://hub.eyeo.com/issues/4523) |
| 6 # | 6 # |
| 7 # === Parameters: | 7 # === Parameters: |
| 8 # | 8 # |
| 9 # [*domain*] | 9 # [*domain*] |
| 10 # The domain name for the website. | 10 # The domain name for the website. |
| 11 # | 11 # |
| 12 # [*ssl_certificate*] | 12 # [*ssl_certificate*] |
| 13 # The name of the SSL certificate file within modules/private/files, if any. | 13 # The name of the SSL certificate file within modules/private/files, if any. |
| 14 # Requires a private_key as well. | 14 # Requires a private_key as well. |
| 15 # | 15 # |
| 16 # [*ssl_private_key*] | 16 # [*ssl_private_key*] |
| 17 # The name of the private key file within modules/private/files, if any. | 17 # The name of the private key file within modules/private/files, if any. |
| 18 # Requires a certificate as well. | 18 # Requires a certificate as well. |
| 19 # | 19 # |
| 20 # [*ensure*] | 20 # [*ensure*] |
| 21 # Whether to set up the website or not. | 21 # Whether to set up the website or not, e.g. "asbsent" or "present". |
|
mathias
2018/04/17 15:57:13
This should mention possible values, e.g. "absent"
f.lopez
2018/04/17 18:02:22
Acknowledged.
| |
| 22 # | 22 # |
| 23 # [*deploy_user*] | 23 # [*deploy_user*] |
| 24 # User that will be used to issue commands. | 24 # User that will be used to issue commands. |
| 25 # | 25 # |
| 26 # [*deploy_user_authorized_keys*] | 26 # [*deploy_user_authorized_keys*] |
| 27 # Array of public keys that will have access to ssh commands | 27 # Array of public keys that will have access to ssh commands |
| 28 # | 28 # |
| 29 # [*hooks*] | 29 # [*hooks*] |
| 30 # Hash of adblockplus::web::static::hook items to set up in this context. | 30 # Hash of adblockplus::web::static::hook items to set up in this context. |
| 31 # | 31 # |
| 32 # === Examples: | 32 # === Examples: |
| 33 # | 33 # |
| 34 # class {'adblockplus::web::static': | 34 # class {'adblockplus::web::static': |
| 35 # domain => 'help.eyeo.com', | 35 # domain => 'help.eyeo.com', |
| 36 # hooks => { | 36 # hooks => { |
| 37 # own-uname => { | 37 # uname => { |
| 38 # file => { | 38 # file => { |
| 39 # content => 'uname -a', | 39 # content => 'uname -a', |
| 40 # } | 40 # }, |
| 41 # } | 41 # }, |
| 42 # uptime => { | |
| 43 # file => { | |
| 44 # target => '/usr/bin/uptime', | |
| 45 # ensure => 'link', | |
| 46 # }, | |
| 47 # }, | |
| 42 # }, | 48 # }, |
| 43 # } | 49 # } |
| 44 # | 50 # |
| 45 class adblockplus::web::static ( | 51 class adblockplus::web::static ( |
| 46 $domain, | 52 $domain, |
| 47 $ssl_certificate = undef, | 53 $ssl_certificate = undef, |
| 48 $ssl_private_key = undef, | 54 $ssl_private_key = undef, |
| 49 $ensure = 'present', | 55 $ensure = 'present', |
| 50 $deploy_user = 'web-deploy', | 56 $deploy_user = 'web-deploy', |
| 51 $deploy_user_authorized_keys = [], | 57 $deploy_user_authorized_keys = [], |
| 52 $hooks = {}, | 58 $hooks = {}, |
| 53 ) { | 59 ) { |
| 54 | 60 |
| 55 include adblockplus::web | 61 include adblockplus::web |
| 56 include nginx | 62 include nginx |
| 57 include geoip | |
|
mathias
2018/04/17 15:57:13
Why?
f.lopez
2018/04/17 18:02:22
you are right, there is no need for this just yet.
| |
| 58 include ssh | 63 include ssh |
| 59 | 64 |
| 60 File { | 65 File { |
| 61 mode => '0755', | 66 mode => '0755', |
| 62 owner => $deploy_user, | 67 owner => $deploy_user, |
| 63 group => $deploy_user, | 68 group => $deploy_user, |
| 64 } | 69 } |
| 65 | 70 |
| 66 ensure_resource('file', "/var/www/$domain", { | 71 ensure_resource('file', "/var/www/$domain", { |
| 67 ensure => ensure_directory_state($ensure), | 72 ensure => ensure_directory_state($ensure), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 | 114 |
| 110 ensure_resource('file', '/usr/local/bin/hooks_wrapper', { | 115 ensure_resource('file', '/usr/local/bin/hooks_wrapper', { |
| 111 ensure => ensure_file_state($ensure), | 116 ensure => ensure_file_state($ensure), |
| 112 content => template('adblockplus/web/hooks_wrapper.sh.erb'), | 117 content => template('adblockplus/web/hooks_wrapper.sh.erb'), |
| 113 }) | 118 }) |
| 114 | 119 |
| 115 # https://docs.puppet.com/puppet/latest/function.html#createresources | 120 # https://docs.puppet.com/puppet/latest/function.html#createresources |
| 116 create_resources('adblockplus::web::static::hook', $hooks) | 121 create_resources('adblockplus::web::static::hook', $hooks) |
| 117 } | 122 } |
| 118 | 123 |
| LEFT | RIGHT |