|
1 |
| -# this class installs nginx with unicorn infront of puppetmaster |
| 1 | +# this class installs nginx with unicorn in front of puppetmaster |
| 2 | +# tested only on centos 7 |
| 3 | + |
2 | 4 | class puppet::unicorn () {
|
3 | 5 | include nginx
|
4 |
| -# nginx::resource::vhost {'puppetmaster': |
5 |
| -# www_root => '/var/empty', |
6 |
| -# } |
| 6 | + # install unicorn |
| 7 | + package {['unicorn', 'rack']: |
| 8 | + ensure => 'latest', |
| 9 | + provider => 'gem', |
| 10 | + } -> |
| 11 | + file {'copy-config': |
| 12 | + path => '/etc/puppet/config.ru', |
| 13 | + source => '/usr/share/puppet/ext/rack/config.ru', |
| 14 | + } -> |
| 15 | + file {'unicorn-conf': |
| 16 | + path => '/etc/puppet/unicorn.conf', |
| 17 | + source => 'puppet:///modules/puppet/unicorn.conf', |
| 18 | + |
| 19 | + } -> |
| 20 | + file {'unicorn-service': |
| 21 | + path => '/usr/lib/systemd/system/unicorn-puppetmaster.service', |
| 22 | + source => 'puppet:///modules/puppet/unicorn-puppetmaster.service', |
| 23 | + notify => Exec['systemd-reload'], |
| 24 | + } |
| 25 | + exec{'systemd-reload': |
| 26 | + exec => 'systemctl daemon-reload', |
| 27 | + refreshonly => 'true', |
| 28 | + notify => Service['unicorn-puppetmaster'], |
| 29 | + } |
| 30 | + unless defined(Service['unicorn-puppetmaster']) { |
| 31 | + service{'unicorn-puppetmaster': |
| 32 | + ensure => 'running', |
| 33 | + enable => 'enable', |
| 34 | + } |
| 35 | + } |
| 36 | + # hacky vhost |
| 37 | + file {'puppetmaster-vhost': |
| 38 | + path => '/etc/nginx/sites-available/puppetmaster', |
| 39 | + source => 'puppet:///puppet/puppetmaster', |
| 40 | + } -> |
| 41 | + file {'enable-puppetmaster-vhost': |
| 42 | + path => '/etc/nginx/sites-enabled/puppetmaster', |
| 43 | + ensure => 'link', |
| 44 | + target => '/etc/nginx/sites-available/puppetmaster', |
| 45 | + notify => Service['nginx'], |
| 46 | + } |
| 47 | + unless defined(Service['nginx']) { |
| 48 | + service{'nginx': |
| 49 | + ensure => 'running', |
| 50 | + enable => 'enable', |
| 51 | + } |
| 52 | + } |
7 | 53 | }
|
| 54 | + |
0 commit comments