Skip to content

Instantly share code, notes, and snippets.

@makeittotop
Last active April 19, 2023 19:18
Show Gist options
  • Save makeittotop/24831ea57a3f2eb5d0af to your computer and use it in GitHub Desktop.
Save makeittotop/24831ea57a3f2eb5d0af to your computer and use it in GitHub Desktop.
Install Puppet master and agent with Apache and Phusion Passenger web server as the webserver running puppet master
yum update
yum -y install ntpd git htop telnet tmux nc
chkconfig ntpd on
chkconfig | grep ntpd
// puppet repo - install it on master and clients/agents
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
yum install -y puppet-server.noarch
// for agents
yum install -y puppet
puppet master
puppet master --version
openssl rand -base64 9
openssl rand -base64 10
yum install -y tree
tree environments
mkdir -p /etc/puppet/environments/production/{modules,manifests}
service puppet status
service puppetmaster status
service puppetmaster start
service puppetmaster stop
puppet master --verbose --no-daemonize
less /var/log/puppet/masterhttp.log
rm -rfv /var/lib/puppet/ssl
puppet master --verbose --no-daemonize
service puppetmaster start
service puppetmaster status
# Install apache and phusion passenger
yum install -y httpd httpd-devel mod_ssl ruby-devel rubygems gcc gcc-c++ libcurl-devel openssl-devel
# Install passenger
gem install rack passenger
# Install passenger apache module
passenger-install-apache2-module
#passenger-install-nginx-module
##### Passenger installation info #######
Almost there!
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-5.0.7/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-5.0.7
PassengerDefaultRuby /usr/bin/ruby
</IfModule>
After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!
Press ENTER when you are done editing.
--------------------------------------------
Validating installation...
* Checking whether this Passenger install is in PATH... ✓
* Checking whether there are no other Passenger installations... ✓
* Checking whether the Passenger module is correctly configured in Apache... (!)
You did not specify 'LoadModule passenger_module' in any of your Apache
configuration files. Please paste the configuration snippet that this
installer printed earlier, into one of your Apache configuration files, such
as /etc/httpd/conf/httpd.conf.
Detected 0 error(s), 1 warning(s).
Press ENTER to continue.
--------------------------------------------
Deploying a web application: an example
Suppose you have a web application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
<VirtualHost *:80>
ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /somewhere/public
<Directory /somewhere/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
###############################################
mkdir -pv /usr/share/puppet/rack/puppetmasterd/{public,tmp}
cp /usr/share/puppet/ext/rack/config.ru /usr/share/puppet/rack/puppetmasterd/
vi /usr/share/puppet/rack/puppetmasterd/config.ru
chown puppet.puppet /usr/share/puppet/rack/puppetmasterd/config.ru
# git clone https://github.com/benpiper/puppet-fundamentals-puppetmaster.git
# use my own ... this one has got updated settings for the passenger version
git clone https://github.com/makeittotop/puppet-fundamentals-puppetmaster.git
vi puppet-fundamentals-puppetmaster/puppetmaster.conf => puppetmaster.conf.new
cp puppetmaster.conf.new /etc/httpd/conf.d/puppetmaster.conf
service httpd status
service httpd start
vi /etc/httpd/conf.d/puppetmaster.conf
// puppet master running properly
service httpd start
netstat -tunlep | grep 8140
sudo chkconfig httpd on
history | awk '{$1=""; print $0}'
// On the puppet agents
// Add correct puppet master entry to etc-hosts
yum -y install puppet
// In the "agent" section on /etc/puppet/puppet.conf, add 'server = "puppetmaster"'
// now
puppet agent --verbose --no-daemonize --onetime
// ubuntu
wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
dpkg -i puppetlabs-release-trusty.deb
apt-get update
apt-get install puppet
puppet agent enable
// add 'server = "puppet-master"' in the etc/puppet/puppet.conf file in the [agent] section
// Generate and request cert
puppet agent --verbose --no-daemonize --onetime
// On master, sign certs
puppet master cert sign <host>
// Check the agent
puppet agent --onetime --no-daemonize --verbose
//------------------------//
Info: Caching certificate for puppet-client-1
Info: Caching certificate_revocation_list for ca
Info: Caching certificate for puppet-client-1
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for puppet-client-1
Info: Applying configuration version '1431798779'
Info: Creating state file /var/lib/puppet/state/state.yaml
//-------------------------------//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment