diff --git a/apache/manifests/config.pp b/apache/manifests/config.pp deleted file mode 100644 index 5e76d03..0000000 --- a/apache/manifests/config.pp +++ /dev/null @@ -1,26 +0,0 @@ -class apache::config { - - group { $apache::params::group: ensure => present, require => Class["apache::install"] } - user { $apache::params::user: - ensure => present, - home => $apache::params::home, - managehome => false, - membership => minimum, - groups => [], - shell => "/sbin/nologin", - require => Group[$apache::params::group], - } - - file{ - "$apache::params::configdir/$apache::params::conffile": - mode => 0644, - notify => Exec["reload-apache"], - require => Class["apache::install"]; - "$apache::params::configdir/": - ensure => directory, - mode => 0644, - notify => Exec["reload-apache"], - require => Class["apache::install"], - } - -} diff --git a/apache/manifests/init.pp b/apache/manifests/init.pp deleted file mode 100644 index afa7f2c..0000000 --- a/apache/manifests/init.pp +++ /dev/null @@ -1,6 +0,0 @@ -class apache { - include apache::params - include apache::install - include apache::config - include apache::service -} diff --git a/apache/manifests/site.pp b/apache/manifests/site.pp deleted file mode 100644 index 96d0b49..0000000 --- a/apache/manifests/site.pp +++ /dev/null @@ -1,12 +0,0 @@ -define apache::site( $admin = "webmaster", $aliases = '', $docroot, $ensure = 'present', $rails = false) { - if $rails { include passenger } - - file { "$apache::params::configdir/$name.conf": - mode => "644", - ensure => $ensure, - require => Package["httpd"], - notify => Exec["reload-apache"], - content => template("apache/vhost.conf"), - } -} - diff --git a/foreman/.project b/foreman/.project new file mode 100644 index 0000000..8553874 --- /dev/null +++ b/foreman/.project @@ -0,0 +1,23 @@ + + + foreman + + + + + + org.cloudsmith.geppetto.pp.dsl.ui.modulefileBuilder + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + + org.cloudsmith.geppetto.pp.dsl.ui.puppetNature + org.eclipse.xtext.ui.shared.xtextNature + + diff --git a/foreman/Modulefile b/foreman/Modulefile new file mode 100644 index 0000000..992722a --- /dev/null +++ b/foreman/Modulefile @@ -0,0 +1,6 @@ +name 'marcellods-foreman' +version '0.0.2' + +author 'Ohad Levy' +license '' +dependency 'marcellods/smart_modules' diff --git a/foreman/manifests/config/passenger.pp b/foreman/manifests/config/passenger.pp index 3e2b0d5..a9f9534 100644 --- a/foreman/manifests/config/passenger.pp +++ b/foreman/manifests/config/passenger.pp @@ -1,6 +1,6 @@ class foreman::config::passenger { - include apache::ssl - include ::passenger + include smart_modules::apache::ssl + include smart_modules::passenger file {"foreman_vhost": path => "${foreman::params::apache_conf_dir}/foreman.conf", diff --git a/foreman/metadata.json b/foreman/metadata.json new file mode 100644 index 0000000..8bdeaf3 --- /dev/null +++ b/foreman/metadata.json @@ -0,0 +1,34 @@ +{ + "name": "marcellods-foreman", + "author": "Ohad Levy", + "description": "", + "license": "", + "project_page": "", + "source": "", + "summary": "", + "version": "0.0.2", + "checksums": { + "Modulefile": "6ac303d52fb2fef1d0560aa28fa4cb6c", + "lib\\puppet\\parser\\functions\\foreman.rb": "fddf65a65b9d5371d6ad02a451ea0683", + "lib\\puppet\\parser\\functions\\smartvar.rb": "1135655507e691d311cf4e6e65f93556", + "manifests\\config.pp": "cbce4a5962c3f5e651d90626ba61e447", + "manifests\\config\\enc.pp": "91e3ef6bb0f8850d5bff3105272ecc78", + "manifests\\config\\passenger.pp": "18d5f8e2abcc06ee3ec14142a1195f32", + "manifests\\config\\reports.pp": "fb56a3f26e243d51684c4b3ad5853823", + "manifests\\init.pp": "37c9101280241eb86c4fe70775b78615", + "manifests\\install.pp": "72e328d7e7bd98a95a1af58a33f6067a", + "manifests\\install\\repos.pp": "2d77774c73d7b82494e2152f223dbd64", + "manifests\\params.pp": "af2e61d1fe87d198aa5117c1864a0a83", + "manifests\\service.pp": "38a461d67cf244ae96bd39655163b2b6", + "templates\\database.yaml.erb": "57194f3432d602f0f55a4b6f5d98a234", + "templates\\external_node.rb.erb": "47b3fd1f354d435e589bf1fe25299d22", + "templates\\foreman-report.rb.erb": "29cf5f3ed2b0b0399cbd8d1a6e137ff0", + "templates\\foreman-vhost.conf.erb": "f95d3e631332ec7da85e8e8c35bddfb3", + "templates\\settings.yaml.erb": "7020b74aae6c04c9285115fa1e0e207b" + }, + "dependencies": [ + { + "name": "marcellods/smart_modules" + } + ] +} \ No newline at end of file diff --git a/foreman_proxy/.project b/foreman_proxy/.project new file mode 100644 index 0000000..9e6bce4 --- /dev/null +++ b/foreman_proxy/.project @@ -0,0 +1,23 @@ + + + foreman_proxy + + + + + + org.cloudsmith.geppetto.pp.dsl.ui.modulefileBuilder + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + + org.cloudsmith.geppetto.pp.dsl.ui.puppetNature + org.eclipse.xtext.ui.shared.xtextNature + + diff --git a/foreman_proxy/Modulefile b/foreman_proxy/Modulefile new file mode 100644 index 0000000..7305a2f --- /dev/null +++ b/foreman_proxy/Modulefile @@ -0,0 +1,7 @@ +name 'marcellods-foreman_proxy' +version '0.0.2' + +author 'Ohad Levy' +license '' +dependency 'marcellods/smart_modules' +dependency 'marcellods/foreman' diff --git a/foreman_proxy/manifests/params.pp b/foreman_proxy/manifests/params.pp index 13b62ac..f57e117 100644 --- a/foreman_proxy/manifests/params.pp +++ b/foreman_proxy/manifests/params.pp @@ -15,11 +15,11 @@ $puppetrun_cmd = "/usr/sbin/puppetrun" # TFTP settings - require "tftp" # ensures we can access tftp module parameters + require "smart_modules" # ensures we can access tftp module parameters $tftp = true $syslinux_root = "/usr/share/syslinux" $syslinux_files = ["pxelinux.0","menu.c32","chain.c32"] - $tftproot = $tftp::params::root + $tftproot = $smart_modules::tftp::params::root $tftp_dir = ["${tftproot}/pxelinux.cfg","${tftproot}/boot"] $dhcp = false diff --git a/foreman_proxy/manifests/tftp.pp b/foreman_proxy/manifests/tftp.pp index 0ce7aaf..a22f6c7 100644 --- a/foreman_proxy/manifests/tftp.pp +++ b/foreman_proxy/manifests/tftp.pp @@ -1,23 +1,23 @@ class foreman_proxy::tftp { - include ::tftp + include smart_modules::tftp file{ $foreman_proxy::params::tftp_dir: + ensure => directory, owner => $foreman_proxy::params::user, - mode => 644, + mode => '0644', require => Class["foreman_proxy::install"], - ensure => directory, recurse => true; } - link_file{$foreman_proxy::params::syslinux_files: + sync_file{$foreman_proxy::params::syslinux_files: source_path => $foreman_proxy::params::syslinux_root, target_path => $foreman_proxy::params::tftproot, - require => Class["tftp::install"]; + require => Class["smart_modules::tftp::install"]; } } -define link_file($source_path, $target_path) { +define sync_file($source_path, $target_path) { file{"$target_path/$name": - ensure => link, - target => "$source_path/$name" + ensure => present, + source => "$source_path/$name" } } diff --git a/foreman_proxy/metadata.json b/foreman_proxy/metadata.json new file mode 100644 index 0000000..f995f43 --- /dev/null +++ b/foreman_proxy/metadata.json @@ -0,0 +1,29 @@ +{ + "name": "marcellods-foreman_proxy", + "author": "Ohad Levy", + "description": "", + "license": "", + "project_page": "", + "source": "", + "summary": "", + "version": "0.0.2", + "checksums": { + "Modulefile": "72cbd1bfd5da454510bc3ffa457a2a4e", + "manifests\\config.pp": "d6c5a1e11c994da8fc693a73fcae24d2", + "manifests\\init.pp": "d636fdcd3aa2c44f075e499fbdf8e1a9", + "manifests\\install.pp": "983b631f5531bc2ae35c7efe204f0829", + "manifests\\params.pp": "725ac0e1066068b578d88da4e7319635", + "manifests\\puppetca.pp": "e7acddf69eceee360bfe61759fbae67b", + "manifests\\service.pp": "ab51e7b1f59ad78ce3d8559791f01603", + "manifests\\tftp.pp": "c450aa3c372a620d522194e8c95a2aea", + "templates\\settings.yml.erb": "f12b87c2e0ef5ce329db5aefeef23222" + }, + "dependencies": [ + { + "name": "marcellods/smart_modules" + }, + { + "name": "marcellods/foreman" + } + ] +} \ No newline at end of file diff --git a/foreman_proxy/templates/server/puppet-server.conf.erb b/foreman_proxy/templates/server/puppet-server.conf.erb new file mode 100644 index 0000000..da13ff0 --- /dev/null +++ b/foreman_proxy/templates/server/puppet-server.conf.erb @@ -0,0 +1,11 @@ + +[master] + autosign = $confdir/autosign.conf { mode = 664 } + reports = foreman + external_nodes = /etc/puppet/node.rb + node_terminus = exec + +<% scope.lookupvar("foreman_proxy::puppet::params::environments").each do |env| -%> +[<%= env %>] + modulepath = <%= scope.lookupvar("foreman_proxy::puppet::params::modules_path") %>/<%= env %>:<%= scope.lookupvar("foreman_proxy::puppet::params::common_modules_path") %> +<% end -%> diff --git a/passenger/manifests/init.pp b/passenger/manifests/init.pp deleted file mode 100644 index feaec6c..0000000 --- a/passenger/manifests/init.pp +++ /dev/null @@ -1,5 +0,0 @@ -class passenger { - include apache - include passenger::install - -} diff --git a/passenger/manifests/install.pp b/passenger/manifests/install.pp deleted file mode 100644 index 5e6f82c..0000000 --- a/passenger/manifests/install.pp +++ /dev/null @@ -1,7 +0,0 @@ -class passenger::install { - case $operatingsystem { - redhat,centos,fedora,Scientific: { include passenger::install::redhat } - Debian,Ubuntu: { include passenger::install::debian } - default: { fail("${hostname}: This module does not support operatingsystem $operatingsystem") } - } -} diff --git a/passenger/manifests/install/debian.pp b/passenger/manifests/install/debian.pp deleted file mode 100644 index 00b411f..0000000 --- a/passenger/manifests/install/debian.pp +++ /dev/null @@ -1,10 +0,0 @@ -class passenger::install::debian { - - package{"passenger": - name => "libapache2-mod-passenger", - ensure => installed, - require => Class["apache::install"], - before => Class["apache::service"], - } - -} diff --git a/puppet/manifests/config.pp b/puppet/manifests/config.pp deleted file mode 100644 index 6fa224a..0000000 --- a/puppet/manifests/config.pp +++ /dev/null @@ -1,7 +0,0 @@ -class puppet::config { - file { - $puppet::params::dir: ensure => directory; - "${puppet::params::dir}/puppet.conf": content => template("puppet/puppet.conf.erb"); - } - -} diff --git a/puppet/manifests/init.pp b/puppet/manifests/init.pp deleted file mode 100644 index f71eb5c..0000000 --- a/puppet/manifests/init.pp +++ /dev/null @@ -1,5 +0,0 @@ -class puppet { - include puppet::params - include puppet::install - include puppet::config -} diff --git a/puppet/manifests/server.pp b/puppet/manifests/server.pp deleted file mode 100644 index 76a0cc4..0000000 --- a/puppet/manifests/server.pp +++ /dev/null @@ -1,4 +0,0 @@ -class puppet::server { - include puppet::server::install - include puppet::server::config -} diff --git a/puppet/manifests/server/config.pp b/puppet/manifests/server/config.pp deleted file mode 100644 index 6d976e5..0000000 --- a/puppet/manifests/server/config.pp +++ /dev/null @@ -1,22 +0,0 @@ -class puppet::server::config inherits puppet::config { - if $puppet::params::passenger { include puppet::server::passenger } - - File ["${puppet::params::dir}/puppet.conf"] { content => template("puppet/puppet.conf.erb", "puppet/server/puppet.conf.erb") } - - file { [$puppet::params::modules_path, $puppet::params::common_modules_path]: - ensure => directory, - } - - exec {"generate_ca_cert": - creates => "${puppet::params::ssl_dir}/certs/${fqdn}.pem", - command => "puppetca --generate ${fqdn}", - path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - } - - # setup empty directories for our environments - env{$puppet::params::environments:} - - define env() { - file{"$puppet::params::modules_path/$name": ensure => directory} - } -} diff --git a/puppet/manifests/server/passenger.pp b/puppet/manifests/server/passenger.pp deleted file mode 100644 index 6fcb42a..0000000 --- a/puppet/manifests/server/passenger.pp +++ /dev/null @@ -1,30 +0,0 @@ -class puppet::server::passenger { - include apache::ssl - include ::passenger - - file {"puppet_vhost": - path => "${puppet::params::apache_conf_dir}/puppet.conf", - content => template("puppet/server/puppet-vhost.conf.erb"), - mode => 644, - notify => Exec["reload-apache"], - } - - exec {"restart_puppet": - command => "/bin/touch ${puppet::params::app_root}/tmp/restart.txt", - refreshonly => true, - cwd => $puppet::params::app_root, - path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - require => Class["puppet::server::install"] - } - - file { - [$puppet::params::app_root, "${puppet::params::app_root}/public", "${puppet::params::app_root}/tmp"]: - ensure => directory, - owner => $puppet::params::user; - "${puppet::params::app_root}/config.ru": - owner => $puppet::params::user, - source => "puppet:///modules/puppet/config.ru", - notify => Exec["restart_puppet"]; - } - -} diff --git a/puppet/templates/server/puppet-vhost.conf.erb b/puppet/templates/server/puppet-vhost.conf.erb deleted file mode 100644 index 5b6188c..0000000 --- a/puppet/templates/server/puppet-vhost.conf.erb +++ /dev/null @@ -1,33 +0,0 @@ -Listen 8140 - - - SSLEngine on - SSLCipherSuite SSLv2:-LOW:-EXPORT:RC4+RSA - SSLCertificateFile <%= scope.lookupvar("puppet::params::ssl_dir") %>/certs/<%= fqdn %>.pem - SSLCertificateKeyFile <%= scope.lookupvar("puppet::params::ssl_dir") %>/private_keys/<%= fqdn %>.pem -<% unless scope.lookupvar("puppet::params::ca") %> -%> - SSLCACertificateFile <%= scope.lookupvar("puppet::params::ssl_dir") %>/certs/ca.pem -<% else -%> - SSLCertificateChainFile <%= scope.lookupvar("puppet::params::ssl_dir") %>/ca/ca_crt.pem - SSLCACertificateFile <%= scope.lookupvar("puppet::params::ssl_dir") %>/ca/ca_crt.pem - # CRL checking should be enabled; if you have problems with Apache complaining about the CRL, disable the next line -# SSLCARevocationFile <%= scope.lookupvar("puppet::params::ssl_dir") %>/ca/ca_crl.pem -<% end -%> - SSLVerifyClient optional - SSLVerifyDepth 1 - SSLOptions +StdEnvVars - - # The following client headers allow the same configuration to work with Pound. - RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e - RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e - RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e - - RackAutoDetect On - DocumentRoot <%= scope.lookupvar("puppet::params::app_root") %>/public/ - > - Options None - AllowOverride None - Order allow,deny - allow from all - - diff --git a/puppet/templates/server/puppet.conf.erb b/puppet/templates/server/puppet.conf.erb deleted file mode 100644 index aee89df..0000000 --- a/puppet/templates/server/puppet.conf.erb +++ /dev/null @@ -1,10 +0,0 @@ - -[master] - reports = foreman - external_nodes = /etc/puppet/node.rb - node_terminus = exec - -<% scope.lookupvar("puppet::params::environments").each do |env| -%> -[<%= env %>] - modulepath = <%= scope.lookupvar("puppet::params::modules_path") %>/<%= env %>:<%= scope.lookupvar("puppet::params::common_modules_path") %> -<% end -%> diff --git a/smart_modules/.project b/smart_modules/.project new file mode 100644 index 0000000..61da7de --- /dev/null +++ b/smart_modules/.project @@ -0,0 +1,23 @@ + + + smart_modules + + + + + + org.cloudsmith.geppetto.pp.dsl.ui.modulefileBuilder + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + + org.cloudsmith.geppetto.pp.dsl.ui.puppetNature + org.eclipse.xtext.ui.shared.xtextNature + + diff --git a/smart_modules/Modulefile b/smart_modules/Modulefile new file mode 100644 index 0000000..cfb95f4 --- /dev/null +++ b/smart_modules/Modulefile @@ -0,0 +1,10 @@ +name 'marcellods-smart_modules' +version '0.0.1' + +author 'Ohad Levy' +license '' +project_page '' +source '' +summary '' +description '' +dependency 'marcellods/foreman' diff --git a/smart_modules/README b/smart_modules/README new file mode 100644 index 0000000..8b19366 --- /dev/null +++ b/smart_modules/README @@ -0,0 +1,3 @@ +smart_modules + +This is the smart_modules module. diff --git a/puppet/files/config.ru b/smart_modules/files/puppet/config.ru similarity index 100% rename from puppet/files/config.ru rename to smart_modules/files/puppet/config.ru diff --git a/smart_modules/manifests/apache/manifests/config.pp b/smart_modules/manifests/apache/manifests/config.pp new file mode 100644 index 0000000..fc06775 --- /dev/null +++ b/smart_modules/manifests/apache/manifests/config.pp @@ -0,0 +1,26 @@ +class smart_modules::apache::config { + + group { $smart_modules::apache::params::group: ensure => present, require => Class["smart_modules::apache::install"] } + user { $smart_modules::apache::params::user: + ensure => present, + home => $smart_modules::apache::params::home, + managehome => false, + membership => minimum, + groups => [], + shell => "/sbin/nologin", + require => Group[$smart_modules::apache::params::group], + } + + file{ + "$smart_modules::apache::params::configdir/$smart_modules::apache::params::conffile": + mode => 0644, + notify => Exec["reload-apache"], + require => Class["smart_modules::apache::install"]; + "$smart_modules::apache::params::configdir/": + ensure => directory, + mode => 0644, + notify => Exec["reload-apache"], + require => Class["smart_modules::apache::install"], + } + +} diff --git a/smart_modules/manifests/apache/manifests/init.pp b/smart_modules/manifests/apache/manifests/init.pp new file mode 100644 index 0000000..924fc03 --- /dev/null +++ b/smart_modules/manifests/apache/manifests/init.pp @@ -0,0 +1,6 @@ +class smart_modules::apache { + include smart_modules::apache::params + include smart_modules::apache::install + include smart_modules::apache::config + include smart_modules::apache::service +} diff --git a/apache/manifests/install.pp b/smart_modules/manifests/apache/manifests/install.pp similarity index 89% rename from apache/manifests/install.pp rename to smart_modules/manifests/apache/manifests/install.pp index 71e539b..9c40591 100644 --- a/apache/manifests/install.pp +++ b/smart_modules/manifests/apache/manifests/install.pp @@ -1,4 +1,4 @@ -class apache::install { +class smart_modules::apache::install { case $operatingsystem { redhat,centos,fedora,Scientific: { $http_package = "httpd" } Debian,Ubuntu: { $http_package = "apache2" } diff --git a/apache/manifests/params.pp b/smart_modules/manifests/apache/manifests/params.pp similarity index 90% rename from apache/manifests/params.pp rename to smart_modules/manifests/apache/manifests/params.pp index 22d67f6..8ff2f9b 100644 --- a/apache/manifests/params.pp +++ b/smart_modules/manifests/apache/manifests/params.pp @@ -1,4 +1,4 @@ -class apache::params { +class smart_modules::apache::params { case $operatingsystem { Debian,Ubuntu: { $user = "www-data" diff --git a/apache/manifests/service.pp b/smart_modules/manifests/apache/manifests/service.pp similarity index 92% rename from apache/manifests/service.pp rename to smart_modules/manifests/apache/manifests/service.pp index 401e567..f13d0f0 100644 --- a/apache/manifests/service.pp +++ b/smart_modules/manifests/apache/manifests/service.pp @@ -1,4 +1,4 @@ -class apache::service { +class smart_modules::apache::service { $http_service = $operatingsystem ? { /(Debian|Ubuntu)/ => "apache2", default => "httpd", diff --git a/smart_modules/manifests/apache/manifests/site.pp b/smart_modules/manifests/apache/manifests/site.pp new file mode 100644 index 0000000..1c96811 --- /dev/null +++ b/smart_modules/manifests/apache/manifests/site.pp @@ -0,0 +1,12 @@ +define smart_modules::apache::site( $admin = "webmaster", $aliases = '', $docroot, $ensure = 'present', $rails = false) { + if $rails { include smart_modules::passenger } + + file { "$smart_modules::apache::params::configdir/$name.conf": + mode => "644", + ensure => $ensure, + require => Package["httpd"], + notify => Exec["reload-apache"], + content => template("smart_modules/vhost.conf"), + } +} + diff --git a/apache/manifests/ssl.pp b/smart_modules/manifests/apache/manifests/ssl.pp similarity index 72% rename from apache/manifests/ssl.pp rename to smart_modules/manifests/apache/manifests/ssl.pp index 581a683..dd5afd9 100644 --- a/apache/manifests/ssl.pp +++ b/smart_modules/manifests/apache/manifests/ssl.pp @@ -1,5 +1,5 @@ -class apache::ssl { - include apache +class smart_modules::apache::ssl { + include smart_modules::apache case $operatingsystem { Debian,Ubuntu: { @@ -7,16 +7,16 @@ command => "/usr/sbin/a2enmod ssl", creates => "/etc/apache2/mods-enabled/ssl.load", notify => Service["httpd"], - require => Class["apache::install"], + require => Class["smart_modules::apache::install"], } } default: { package { "mod_ssl": ensure => present, require => Package["httpd"], - notify => Class["apache::service"], + notify => Class["smart_modules::apache::service"], } file { - "$apache::params::configdir/ssl.conf": + "$smart_modules::apache::params::configdir/ssl.conf": mode => 0644, owner => root, group => root, notify => Exec["reload-apache"]; ["/var/cache/mod_ssl", "/var/cache/mod_ssl/scache"]: diff --git a/smart_modules/manifests/init.pp b/smart_modules/manifests/init.pp new file mode 100644 index 0000000..80e700a --- /dev/null +++ b/smart_modules/manifests/init.pp @@ -0,0 +1,25 @@ +# Class: smart_modules +# +# This module manages smart_modules +# +# Parameters: +# +# Actions: +# +# Requires: +# +# Sample Usage: +# +# [Remember: No empty lines between comments and class definition] +import "apache/manifests/*.pp" +import "passenger/manifests/*.pp" +import "passenger/manifests/install/*.pp" +import "puppet/manifests/*.pp" +import "puppet/manifests/server/*.pp" +import "xinetd/manifests/*.pp" +import "tftp/manifests/*.pp" + +class smart_modules { + + include smart_modules::tftp::params +} diff --git a/smart_modules/manifests/passenger/manifests/init.pp b/smart_modules/manifests/passenger/manifests/init.pp new file mode 100644 index 0000000..2968f57 --- /dev/null +++ b/smart_modules/manifests/passenger/manifests/init.pp @@ -0,0 +1,5 @@ +class smart_modules::passenger { + include smart_modules::apache + include smart_modules::passenger::install + +} diff --git a/smart_modules/manifests/passenger/manifests/install.pp b/smart_modules/manifests/passenger/manifests/install.pp new file mode 100644 index 0000000..230e855 --- /dev/null +++ b/smart_modules/manifests/passenger/manifests/install.pp @@ -0,0 +1,7 @@ +class smart_modules::passenger::install { + case $operatingsystem { + redhat,centos,fedora,Scientific: { include smart_modules::passenger::install::redhat } + Debian,Ubuntu: { include smart_modules::passenger::install::debian } + default: { fail("${hostname}: This module does not support operatingsystem $operatingsystem") } + } +} diff --git a/smart_modules/manifests/passenger/manifests/install/debian.pp b/smart_modules/manifests/passenger/manifests/install/debian.pp new file mode 100644 index 0000000..1367447 --- /dev/null +++ b/smart_modules/manifests/passenger/manifests/install/debian.pp @@ -0,0 +1,10 @@ +class smart_modules::passenger::install::debian { + + package{"passenger": + name => "libapache2-mod-passenger", + ensure => installed, + require => Class["smart_modules::apache::install"], + before => Class["smart_modules::apache::service"], + } + +} diff --git a/passenger/manifests/install/redhat.pp b/smart_modules/manifests/passenger/manifests/install/redhat.pp similarity index 74% rename from passenger/manifests/install/redhat.pp rename to smart_modules/manifests/passenger/manifests/install/redhat.pp index f466f4f..fac4a10 100644 --- a/passenger/manifests/install/redhat.pp +++ b/smart_modules/manifests/passenger/manifests/install/redhat.pp @@ -1,4 +1,4 @@ -class passenger::install::redhat { +class smart_modules::passenger::install::redhat { $os_type = $operatingsystem ? { "Fedora" => "fedora/${operatingsystemrelease}", default => inline_template("rhel/<%= operatingsystemrelease.split('.')[0] %>") @@ -14,8 +14,8 @@ package{"passenger": name => "mod_passenger", ensure => installed, - require => Class["apache::install"], - before => Class["apache::service"], + require => Class["smart_modules::apache::install"], + before => Class["smart_modules::apache::service"], } } diff --git a/smart_modules/manifests/puppet/manifests/config.pp b/smart_modules/manifests/puppet/manifests/config.pp new file mode 100644 index 0000000..91b617c --- /dev/null +++ b/smart_modules/manifests/puppet/manifests/config.pp @@ -0,0 +1,7 @@ +class smart_modules::puppet::config { + file { + $smart_modules::puppet::params::dir: ensure => directory; + "${smart_modules::puppet::params::dir}/puppet.conf": content => template("smart_modules/puppet.conf.erb"); + } + +} diff --git a/smart_modules/manifests/puppet/manifests/init.pp b/smart_modules/manifests/puppet/manifests/init.pp new file mode 100644 index 0000000..d7ff13e --- /dev/null +++ b/smart_modules/manifests/puppet/manifests/init.pp @@ -0,0 +1,5 @@ +class smart_modules::puppet { + include smart_modules::puppet::params + include smart_modules::puppet::install + include smart_modules::puppet::config +} diff --git a/puppet/manifests/install.pp b/smart_modules/manifests/puppet/manifests/install.pp similarity index 53% rename from puppet/manifests/install.pp rename to smart_modules/manifests/puppet/manifests/install.pp index a250032..4ba3d0c 100644 --- a/puppet/manifests/install.pp +++ b/smart_modules/manifests/puppet/manifests/install.pp @@ -1,3 +1,3 @@ -class puppet::install { +class smart_modules::puppet::install { package { "puppet": ensure => installed } } diff --git a/puppet/manifests/params.pp b/smart_modules/manifests/puppet/manifests/params.pp similarity index 92% rename from puppet/manifests/params.pp rename to smart_modules/manifests/puppet/manifests/params.pp index 498711b..b0420b1 100644 --- a/puppet/manifests/params.pp +++ b/smart_modules/manifests/puppet/manifests/params.pp @@ -1,4 +1,4 @@ -class puppet::params { +class smart_modules::puppet::params { include foreman::params $user = "puppet" diff --git a/smart_modules/manifests/puppet/manifests/server.pp b/smart_modules/manifests/puppet/manifests/server.pp new file mode 100644 index 0000000..3197984 --- /dev/null +++ b/smart_modules/manifests/puppet/manifests/server.pp @@ -0,0 +1,4 @@ +class smart_modules::puppet::server { + include smart_modules::puppet::server::install + include smart_modules::puppet::server::config +} diff --git a/smart_modules/manifests/puppet/manifests/server/config.pp b/smart_modules/manifests/puppet/manifests/server/config.pp new file mode 100644 index 0000000..d9cd5b0 --- /dev/null +++ b/smart_modules/manifests/puppet/manifests/server/config.pp @@ -0,0 +1,22 @@ +class smart_modules::puppet::server::config inherits smart_modules::puppet::config { + if $smart_modules::puppet::params::passenger { include smart_modules::puppet::server::passenger } + + File ["${smart_modules::puppet::params::dir}/puppet.conf"] { content => template("smart_modules/puppet.conf.erb", "smart_modules/server/puppet-server.conf.erb") } + + file { [$smart_modules::puppet::params::modules_path, $smart_modules::puppet::params::common_modules_path]: + ensure => directory, + } + + exec {"generate_ca_cert": + creates => "${smart_modules::puppet::params::ssl_dir}/certs/${fqdn}.pem", + command => "puppetca --generate ${fqdn}", + path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + } + + # setup empty directories for our environments + env{$smart_modules::puppet::params::environments:} + + define env() { + file{"$smart_modules::puppet::params::modules_path/$name": ensure => directory} + } +} diff --git a/puppet/manifests/server/install.pp b/smart_modules/manifests/puppet/manifests/server/install.pp similarity index 53% rename from puppet/manifests/server/install.pp rename to smart_modules/manifests/puppet/manifests/server/install.pp index af821f9..c9f37f9 100644 --- a/puppet/manifests/server/install.pp +++ b/smart_modules/manifests/puppet/manifests/server/install.pp @@ -1,4 +1,4 @@ -class puppet::server::install { +class smart_modules::puppet::server::install { package { "puppet-server": ensure => installed } } diff --git a/smart_modules/manifests/puppet/manifests/server/passenger.pp b/smart_modules/manifests/puppet/manifests/server/passenger.pp new file mode 100644 index 0000000..73b56df --- /dev/null +++ b/smart_modules/manifests/puppet/manifests/server/passenger.pp @@ -0,0 +1,30 @@ +class smart_modules::puppet::server::passenger { + include smart_modules::apache::ssl + include smart_modules::passenger + + file {"puppet_vhost": + path => "${smart_modules::puppet::params::apache_conf_dir}/puppet.conf", + content => template("smart_modules/server/puppet-vhost.conf.erb"), + mode => 644, + notify => Exec["reload-apache"], + } + + exec {"restart_puppet": + command => "/bin/touch ${smart_modules::puppet::params::app_root}/tmp/restart.txt", + refreshonly => true, + cwd => $smart_modules::puppet::params::app_root, + path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + require => Class["smart_modules::puppet::server::install"] + } + + file { + [$smart_modules::puppet::params::app_root, "${smart_modules::puppet::params::app_root}/public", "${smart_modules::puppet::params::app_root}/tmp"]: + ensure => directory, + owner => $smart_modules::puppet::params::user; + "${smart_modules::puppet::params::app_root}/config.ru": + owner => $smart_modules::puppet::params::user, + source => "puppet:///modules/smart_modules/puppet/config.ru", + notify => Exec["restart_puppet"]; + } + +} diff --git a/smart_modules/manifests/tftp/manifests/config.pp b/smart_modules/manifests/tftp/manifests/config.pp new file mode 100644 index 0000000..12b0d70 --- /dev/null +++ b/smart_modules/manifests/tftp/manifests/config.pp @@ -0,0 +1,13 @@ +class smart_modules::tftp::config { + file {"/etc/xinetd.d/tftp": + content => template("smart_modules/xinetd-tftp"), + mode => 644, + require => [Class["smart_modules::tftp::install"], Class["smart_modules::xinetd::install"]], + notify => Class["smart_modules::xinetd::service"] + } + + file { $smart_modules::tftp::params::root: + ensure => directory, + notify => Class["smart_modules::xinetd::service"], + } +} diff --git a/smart_modules/manifests/tftp/manifests/init.pp b/smart_modules/manifests/tftp/manifests/init.pp new file mode 100644 index 0000000..9b99b70 --- /dev/null +++ b/smart_modules/manifests/tftp/manifests/init.pp @@ -0,0 +1,6 @@ +class smart_modules::tftp { + include smart_modules::xinetd + include smart_modules::tftp::params + include smart_modules::tftp::install + include smart_modules::tftp::config +} diff --git a/tftp/manifests/install.pp b/smart_modules/manifests/tftp/manifests/install.pp similarity index 90% rename from tftp/manifests/install.pp rename to smart_modules/manifests/tftp/manifests/install.pp index a0211af..0bc8589 100644 --- a/tftp/manifests/install.pp +++ b/smart_modules/manifests/tftp/manifests/install.pp @@ -1,4 +1,4 @@ -class tftp::install { +class smart_modules::tftp::install { case $operatingsystem { redhat,centos,fedora,Scientific: { $tftp_package = "tftp-server" } Debian: { $tftp_package = "atftpd" } diff --git a/smart_modules/manifests/tftp/manifests/params.pp b/smart_modules/manifests/tftp/manifests/params.pp new file mode 100644 index 0000000..97aa969 --- /dev/null +++ b/smart_modules/manifests/tftp/manifests/params.pp @@ -0,0 +1,3 @@ +class smart_modules::tftp::params { + $root = "/tftpboot" +} diff --git a/smart_modules/manifests/xinetd/manifests/init.pp b/smart_modules/manifests/xinetd/manifests/init.pp new file mode 100644 index 0000000..26434ab --- /dev/null +++ b/smart_modules/manifests/xinetd/manifests/init.pp @@ -0,0 +1,4 @@ +class smart_modules::xinetd { + include smart_modules::xinetd::install + include smart_modules::xinetd::service +} diff --git a/xinetd/manifests/install.pp b/smart_modules/manifests/xinetd/manifests/install.pp similarity index 53% rename from xinetd/manifests/install.pp rename to smart_modules/manifests/xinetd/manifests/install.pp index 3c1c39b..2b53feb 100644 --- a/xinetd/manifests/install.pp +++ b/smart_modules/manifests/xinetd/manifests/install.pp @@ -1,3 +1,3 @@ -class xinetd::install { +class smart_modules::xinetd::install { package {"xinetd": ensure => installed} } diff --git a/xinetd/manifests/service.pp b/smart_modules/manifests/xinetd/manifests/service.pp similarity index 57% rename from xinetd/manifests/service.pp rename to smart_modules/manifests/xinetd/manifests/service.pp index 9c766ae..938a7c8 100644 --- a/xinetd/manifests/service.pp +++ b/smart_modules/manifests/xinetd/manifests/service.pp @@ -1,9 +1,9 @@ -class xinetd::service { +class smart_modules::xinetd::service { service {"xinetd": ensure => running, enable => true, hasrestart => true, hasstatus => false, - require => Class["xinetd::install"] + require => Class["smart_modules::xinetd::install"] } } diff --git a/smart_modules/metadata.json b/smart_modules/metadata.json new file mode 100644 index 0000000..176c08f --- /dev/null +++ b/smart_modules/metadata.json @@ -0,0 +1,52 @@ +{ + "name": "marcellods-smart_modules", + "author": "Ohad Levy", + "description": "", + "license": "", + "project_page": "", + "source": "", + "summary": "", + "version": "0.0.1", + "checksums": { + "Modulefile": "16110d912143456b7d7135f5d4e0fa5e", + "README": "a57b28d6bb1ed35d6e8e46516163d6a9", + "files\\puppet\\config.ru": "e0f1c0292e8108cfed8f13f2b44acc7b", + "manifests\\apache\\manifests\\config.pp": "523fb7ea4c33d85a30877295413dddfa", + "manifests\\apache\\manifests\\init.pp": "150beec687b630c4a0840a2191b6c825", + "manifests\\apache\\manifests\\install.pp": "409cef1d3e2d01ad68db40bd8f0344f4", + "manifests\\apache\\manifests\\params.pp": "7523877e693991b80b4f9695ce19ab53", + "manifests\\apache\\manifests\\service.pp": "b59a655f1e42f7b579f66820b0827ada", + "manifests\\apache\\manifests\\site.pp": "a0b909aca71cbf5fdf43070a6ff11c38", + "manifests\\apache\\manifests\\ssl.pp": "e05f1c9941e49132c67562da8d335f6b", + "manifests\\init.pp": "f46f9444b209060e1c1b20cef8f58ba1", + "manifests\\passenger\\manifests\\init.pp": "75d46ffc489aa235cc55cf91e65c380e", + "manifests\\passenger\\manifests\\install.pp": "cdaeb1da6baf20befe3f386c87850b65", + "manifests\\passenger\\manifests\\install\\debian.pp": "09157a0bf30511977754cd573ce8f81d", + "manifests\\passenger\\manifests\\install\\redhat.pp": "f43ea033e2c009bbd00841510861054b", + "manifests\\puppet\\manifests\\config.pp": "1578370c6c1d61317e491ed957bf0eef", + "manifests\\puppet\\manifests\\init.pp": "595e626289f5e1e78dc0fdcd26c082fd", + "manifests\\puppet\\manifests\\install.pp": "d3501b6fe04b34295c8bedab316d2058", + "manifests\\puppet\\manifests\\params.pp": "dccd2de7ecf4ca68fae15636fa02ca0e", + "manifests\\puppet\\manifests\\server.pp": "13f17a02817cda280875fa40bb2403fa", + "manifests\\puppet\\manifests\\server\\config.pp": "47441bc5a4da4f83f3718f2e83528761", + "manifests\\puppet\\manifests\\server\\install.pp": "60f29c5cb6ac33bad864a6d88ac57453", + "manifests\\puppet\\manifests\\server\\passenger.pp": "53b3012017aacb28b79f4ae31d5075c7", + "manifests\\tftp\\manifests\\config.pp": "e84d126f3af3662c01a7165bedc4eeb3", + "manifests\\tftp\\manifests\\init.pp": "e93fa9de8df47feca38f6cb816b99872", + "manifests\\tftp\\manifests\\install.pp": "d8019bfb46be08723ad012360025a71f", + "manifests\\tftp\\manifests\\params.pp": "945cdbf82323e42da77a62c4a04b62cc", + "manifests\\xinetd\\manifests\\init.pp": "3e1f20491c03a22ecd48b1d348030b69", + "manifests\\xinetd\\manifests\\install.pp": "33b8ebfb2e142a5185740ae0ac141557", + "manifests\\xinetd\\manifests\\service.pp": "a420f1f14a82395daffe54dd30e5fb6e", + "templates\\puppet.conf.erb": "efc567bc8e0dd831d3a901373d72e86f", + "templates\\server\\puppet-server.conf.erb": "0f2d106302afc68cecbb7614dc5f9fa0", + "templates\\server\\puppet-vhost.conf.erb": "e66435534b4710b94d38d7b32321ffcb", + "templates\\vhost.conf": "549cc861d7e3cdc072b77f011b7b604c", + "templates\\xinetd-tftp": "5e80945de97dc66a8e7657a9c90b38b9" + }, + "dependencies": [ + { + "name": "marcellods/foreman" + } + ] +} \ No newline at end of file diff --git a/puppet/templates/puppet.conf.erb b/smart_modules/templates/puppet.conf.erb similarity index 100% rename from puppet/templates/puppet.conf.erb rename to smart_modules/templates/puppet.conf.erb diff --git a/smart_modules/templates/server/puppet-server.conf.erb b/smart_modules/templates/server/puppet-server.conf.erb new file mode 100644 index 0000000..80d9dbb --- /dev/null +++ b/smart_modules/templates/server/puppet-server.conf.erb @@ -0,0 +1,11 @@ + +[master] + autosign = $confdir/autosign.conf { mode = 664 } + reports = foreman + external_nodes = /etc/puppet/node.rb + node_terminus = exec + +<% scope.lookupvar("smart_modules::puppet::params::environments").each do |env| -%> +[<%= env %>] + modulepath = <%= scope.lookupvar("smart_modules::puppet::params::modules_path") %>/<%= env %>:<%= scope.lookupvar("smart_modules::puppet::params::common_modules_path") %> +<% end -%> diff --git a/smart_modules/templates/server/puppet-vhost.conf.erb b/smart_modules/templates/server/puppet-vhost.conf.erb new file mode 100644 index 0000000..5981f72 --- /dev/null +++ b/smart_modules/templates/server/puppet-vhost.conf.erb @@ -0,0 +1,33 @@ +Listen 8140 + + + SSLEngine on + SSLCipherSuite SSLv2:-LOW:-EXPORT:RC4+RSA + SSLCertificateFile <%= scope.lookupvar("smart_modules::puppet::params::ssl_dir") %>/certs/<%= fqdn %>.pem + SSLCertificateKeyFile <%= scope.lookupvar("smart_modules::puppet::params::ssl_dir") %>/private_keys/<%= fqdn %>.pem +<% unless scope.lookupvar("smart_modules::puppet::params::ca") %> -%> + SSLCACertificateFile <%= scope.lookupvar("smart_modules::puppet::params::ssl_dir") %>/certs/ca.pem +<% else -%> + SSLCertificateChainFile <%= scope.lookupvar("smart_modules::puppet::params::ssl_dir") %>/ca/ca_crt.pem + SSLCACertificateFile <%= scope.lookupvar("smart_modules::puppet::params::ssl_dir") %>/ca/ca_crt.pem + # CRL checking should be enabled; if you have problems with Apache complaining about the CRL, disable the next line +# SSLCARevocationFile <%= scope.lookupvar("smart_modules::puppet::params::ssl_dir") %>/ca/ca_crl.pem +<% end -%> + SSLVerifyClient optional + SSLVerifyDepth 1 + SSLOptions +StdEnvVars + + # The following client headers allow the same configuration to work with Pound. + RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e + RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e + RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e + + RackAutoDetect On + DocumentRoot <%= scope.lookupvar("smart_modules::puppet::params::app_root") %>/public/ + > + Options None + AllowOverride None + Order allow,deny + allow from all + + diff --git a/apache/templates/vhost.conf b/smart_modules/templates/vhost.conf similarity index 100% rename from apache/templates/vhost.conf rename to smart_modules/templates/vhost.conf diff --git a/tftp/templates/xinetd-tftp b/smart_modules/templates/xinetd-tftp similarity index 72% rename from tftp/templates/xinetd-tftp rename to smart_modules/templates/xinetd-tftp index 2325e17..34d1848 100644 --- a/tftp/templates/xinetd-tftp +++ b/smart_modules/templates/xinetd-tftp @@ -5,7 +5,7 @@ service tftp wait = yes user = root server = /usr/sbin/in.tftpd - server_args = -v -s <%= scope.lookupvar("tftp::params::root") %> + server_args = -v -s <%= scope.lookupvar("smart_modules::tftp::params::root") %> disable = no per_source = 11 cps = 100 2 diff --git a/tftp/manifests/config.pp b/tftp/manifests/config.pp deleted file mode 100644 index 9f291dc..0000000 --- a/tftp/manifests/config.pp +++ /dev/null @@ -1,13 +0,0 @@ -class tftp::config { - file {"/etc/xinetd.d/tftp": - content => template("tftp/xinetd-tftp"), - mode => 644, - require => [Class["tftp::install"], Class["xinetd::install"]], - notify => Class["xinetd::service"] - } - - file { $tftp::params::root: - ensure => directory, - notify => Class["xinetd::service"], - } -} diff --git a/tftp/manifests/init.pp b/tftp/manifests/init.pp deleted file mode 100644 index 6fdaa56..0000000 --- a/tftp/manifests/init.pp +++ /dev/null @@ -1,6 +0,0 @@ -class tftp { - include xinetd - include tftp::params - include tftp::install - include tftp::config -} diff --git a/tftp/manifests/params.pp b/tftp/manifests/params.pp deleted file mode 100644 index 477d3da..0000000 --- a/tftp/manifests/params.pp +++ /dev/null @@ -1,3 +0,0 @@ -class tftp::params { - $root = "/tftpboot" -} diff --git a/xinetd/manifests/init.pp b/xinetd/manifests/init.pp deleted file mode 100644 index 8a1b2a3..0000000 --- a/xinetd/manifests/init.pp +++ /dev/null @@ -1,4 +0,0 @@ -class xinetd { - include xinetd::install - include xinetd::service -}