Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
debug: //bootstrap::install_passenger_apache_module/Exec[install-passenger-apache-module]: Changing returns debug: //bootstrap::install_passenger_apache_module/Exec[install-passenger-apache-module]: 1 change(s) debug: //bootstrap::install_passenger_apache_module/Exec[install-passenger-apache-module]: Executing '/usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/bin/passenger-install-apache2-module --auto' debug: Executing '/usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/bin/passenger-install-apache2-module --auto' err: //bootstrap::install_passenger_apache_module/Exec[install-passenger-apache-module]/returns: change from notrun to 0 failed: /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/bin/passenger-install-apache2-module --auto returned 1 instead of one of [0] at /tmp/setup_puppetmaster.pp:67 # This script will setup a new box as a puppet master, # running under apache and passenger. This lets us # scale quite well. # # You need to have a few things to make this work: # # 1. The EPEL repository (or alternatively the EPEL-testing # repository if there are later versions of puppet installed) # # 2. The 'puppet' and 'puppet-server' packages installed # # Hopefully these things are already setup for you by cobbler. # # To get everything to work simply run: # # puppet --verbose setup_puppetmaster.pp # liftoff include bootstrap # metaclass that just includes our sub-classes for clarity class bootstrap { # Change this if you want a different version installed # The following are known working versions: 2.2.2, 2.2.11 $passenger_version = "2.2.11" include bootstrap::packages include bootstrap::install_passenger_apache_module include bootstrap::modify_httpd_conf include bootstrap::fix_up_rack_files include bootstrap::install } # make sure we have all our necessary packages installed class bootstrap::packages { package { [ "augeas", "apr-devel", "apr-util", "gcc", "gcc-c++", "httpd-devel", "ruby-devel", "rubygems", "make", "httpd" ]: ensure => installed, before => [ Package["rack"], Package["passenger"] ]; [ "puppet-server" , "puppet" ]: ensure => "0.25.4-1.el5"; "rack": ensure => installed, provider => "gem", require => Package["rubygems"]; "passenger": ensure => $passenger_version, provider => "gem", require => Package["rubygems"]; } } # install class bootstrap::install_passenger_apache_module { exec { "install-passenger-apache-module": command => "/usr/lib/ruby/gems/1.8/gems/passenger-$passenger_version/bin/passenger-install-apache2-module --auto", creates => "/usr/lib/ruby/gems/1.8/gems/passenger-$passenger_version/ext/apache2/mod_passenger.so", before => Service["httpd"], path => "/usr/bin", require => Package["passenger"]; } } class bootstrap::modify_httpd_conf { Exec { path => "/bin:/usr/bin:/usr/sbin" } exec { "load-apache-module-httpd-conf": command => "sed -e '/mod_version.so/a\\LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-$passenger_version/ext/apache2/mod_passenger.so' /etc/httpd/conf/httpd.conf > /etc/httpd/conf/httpd.conf.new ; mv /etc/httpd/conf/httpd.conf.new /etc/httpd/conf/httpd.conf", unless => "grep mod_passenger.so /etc/httpd/conf/httpd.conf", before => Exec["specify-passenger-root-httpd-conf"], require => Package["httpd"]; } exec { "specify-passenger-root-httpd-conf": command => "sed -e '/mod_passenger.so/a\\PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-$passenger_version' /etc/httpd/conf/httpd.conf > /etc/httpd/conf/httpd.conf.new ; mv /etc/httpd/conf/httpd.conf.new /etc/httpd/conf/httpd.conf", unless => "grep PassengerRoot /etc/httpd/conf/httpd.conf", before => Exec["specify-passenger-ruby-httpd-conf"], require => [ Package["httpd"], Exec["load-apache-module-httpd-conf"] ]; } exec { "specify-passenger-ruby-httpd-conf": command => "sed -e '/mod_passenger.so/a\\PassengerRuby /usr/bin/ruby' /etc/httpd/conf/httpd.conf > /etc/httpd/conf/httpd.conf.new ; mv /etc/httpd/conf/httpd.conf.new /etc/httpd/conf/httpd.conf", unless => "grep PassengerRuby /etc/httpd/conf/httpd.conf", require => [ Package["httpd"], Exec["specify-passenger-root-httpd-conf"] ]; } } class bootstrap::fix_up_rack_files { #template for our apache configuration $content = "# you probably want to tune these settings PassengerHighPerformance on PassengerMaxPoolSize 12 PassengerPoolIdleTime 1500 # PassengerMaxRequests 1000 PassengerStatThrottleRate 120 RackAutoDetect Off RailsAutoDetect Off Listen 8140 <VirtualHost *:8140> SSLEngine on SSLProtocol -ALL +SSLv3 +TLSv1 SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP SSLCertificateFile /var/lib/puppet/ssl/certs/squigley.namespace.at.pem SSLCertificateKeyFile /var/lib/puppet/ssl/private_keys/squigley.namespace.at.pem SSLCertificateChainFile /var/lib/puppet/ssl/ca/ca_crt.pem SSLCACertificateFile /var/lib/puppet/ssl/ca/ca_crt.pem # If Apache complains about invalid signatures on the CRL, you can try disabling # CRL checking by commenting the next line, but this is not recommended. SSLCARevocationFile /var/lib/puppet/ssl/ca/ca_crl.pem SSLVerifyClient optional SSLVerifyDepth 1 SSLOptions +StdEnvVars DocumentRoot /etc/puppet/rack/public/ RackBaseURI / <Directory /etc/puppet/rack/> Options None AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost> " file { "/usr/share/puppet/ext/rack/files/apache2.conf": content => $content, } file { "/usr/share/puppet/ext/rack/files/config.ru": ensure => present, owner => "puppet", group => "puppet", require => Package["puppet"], } } class bootstrap::install { file { ["/etc/puppet/rack", "/etc/puppet/rack/public"]: ensure => directory, mode => 0755, owner => root, group => root, } file { "/etc/puppet/rack/config.ru": ensure => present, source => [ "puppet:///modules/rack/config.ru", "/usr/share/puppet/ext/rack/files/config.ru" ], mode => 0644, owner => puppet, group => root, require => File[ "/usr/share/puppet/ext/rack/files/config.ru" ], } file { "/etc/httpd/conf.d/puppetmasterd": ensure => present, source => [ "puppet:///modules/rack/apache2.conf", "/usr/share/puppet/ext/rack/files/config.ru" ], mode => 0644, owner => root, group => root, require => [File["/etc/puppet/rack/config.ru"], File["/etc/puppet/rack/public"], Package["httpd"], Package["passenger"]], notify => Service["httpd"], } service { "httpd": ensure => running, require => Package["httpd"], } }
This paste will be private.
From the Design Piracy series on my blog: