diff options
Diffstat (limited to 'manifests/init.pp')
-rw-r--r-- | manifests/init.pp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..1704390 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,45 @@ +# TODO: check permission on SSL keys +class nginx { + # the needed packages + package { "nginx": ensure => installed, } + + # nginx service + service { "nginx": + enable => true, + ensure => running, + hasrestart => true, + require => [ File["/etc/nginx/sites-enabled/$domain"], Package["nginx"] ], + } + + # proxy config file + file { "/etc/nginx/sites-available/$domain": + source => "puppet://$server/files/etc/nginx/$domain", + owner => "root", + group => "root", + mode => 0644, + ensure => present, + notify => Service["nginx"], + require => File["/etc/nginx/sites-available"], + } + + # symlink to enable proxy configuration + file { "/etc/nginx/sites-enabled/$domain": + ensure => "/etc/nginx/sites-available/$domain", + require => File["/etc/nginx/sites-enabled"], + notify => Service["nginx"], + } + + # config folder + file { "/etc/nginx/sites-available": + ensure => directory, + owner => "root", + group => "root", + } + + # config folder + file { "/etc/nginx/sites-enabled": + ensure => directory, + owner => "root", + group => "root", + } +} |