| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 class web::server($vhost, $repository) { | |
| 2 File { | |
| 3 owner => 'root', | |
| 4 group => 'root', | |
| 5 mode => 0644, | |
| 6 } | |
| 7 | |
| 8 Cron { | |
| 9 environment => ['MAILTO=admin@adblockplus.org', 'PYTHONPATH=/opt/sitescripts '], | |
| 10 } | |
| 11 | |
| 12 include nginx | |
| 13 | |
| 14 package {['python-jinja2', 'python-markdown']:} | |
| 15 | |
| 16 file {'/etc/nginx/sites-enabled/default': | |
|
Felix Dahlke
2013/12/05 06:06:44
The nginx module already has this.
| |
| 17 ensure => absent, | |
| 18 require => Package['nginx'], | |
| 19 } | |
| 20 | |
| 21 file {"/etc/nginx/sites-available/${vhost}": | |
|
Felix Dahlke
2013/12/05 06:06:44
Why not use nginx::hostconfig?
| |
| 22 content => template('web/site.erb'), | |
| 23 require => Package['nginx'], | |
| 24 notify => Service['nginx'], | |
| 25 } | |
| 26 | |
| 27 file {"/etc/nginx/sites-enabled/${vhost}": | |
| 28 ensure => link, | |
| 29 target => "/etc/nginx/sites-available/${vhost}", | |
| 30 notify => Service['nginx'], | |
| 31 } | |
| 32 | |
| 33 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.key': | |
|
Felix Dahlke
2013/12/05 06:06:44
Shouldn't especially the key have mode 0400?
| |
| 34 ensure => file, | |
| 35 require => Package['nginx'], | |
| 36 source => 'puppet:///modules/private/adblockplus.org_sslcert.key', | |
| 37 } | |
| 38 | |
| 39 file {'/etc/nginx/sites-available/adblockplus.org_sslcert.pem': | |
| 40 ensure => file, | |
| 41 mode => 0400, | |
| 42 require => Package['nginx'], | |
| 43 source => 'puppet:///modules/private/adblockplus.org_sslcert.pem', | |
| 44 } | |
| 45 | |
| 46 class {'sitescripts': | |
| 47 sitescriptsini_source => 'puppet:///modules/web/sitescripts', | |
| 48 } | |
| 49 | |
| 50 user {'wwwuser': | |
|
Felix Dahlke
2013/12/05 06:06:44
I'd vote for just 'www' here, that's in line with
| |
| 51 ensure => present, | |
| 52 comment => 'Web content owner', | |
| 53 home => '/home/wwwuser', | |
| 54 managehome => true, | |
| 55 } | |
| 56 | |
| 57 exec {"fetch_repo": | |
| 58 command => "hg clone -U https://hg.adblockplus.org/${repository} /home/wwwus er/${repository}", | |
| 59 path => ["/usr/bin/", "/bin/"], | |
| 60 require => Package['mercurial'], | |
| 61 user => wwwuser, | |
| 62 timeout => 0, | |
| 63 onlyif => "test ! -d /home/wwwuser/${repository}", | |
| 64 } | |
| 65 | |
| 66 file {'/var/www': | |
| 67 ensure => directory, | |
| 68 mode => 755, | |
| 69 } | |
| 70 | |
| 71 file {"/var/www/${vhost}": | |
| 72 ensure => directory, | |
| 73 owner => wwwuser, | |
| 74 mode => 755, | |
| 75 } | |
| 76 | |
| 77 cron {'update_repo': | |
| 78 ensure => present, | |
| 79 command => "hg pull -q -R /home/wwwuser/${repository} && python -m sitescrip ts.cms.bin.generate_static_pages /home/wwwuser/${repository} /var/www/${vhost}", | |
| 80 user => wwwuser, | |
| 81 minute => '*/10', | |
| 82 } | |
| 83 } | |
| OLD | NEW |