Skip to content

Instantly share code, notes, and snippets.

@weatheredwatcher
Created February 4, 2013 03:48
Show Gist options
  • Save weatheredwatcher/4704923 to your computer and use it in GitHub Desktop.
Save weatheredwatcher/4704923 to your computer and use it in GitHub Desktop.
Here is a base puppet script that installs Zend Community Server on Red Hat/Cent OS/Fedora. To make this work for a Debian based server, you really just need to modify the repos class to write a apt source file. We also shut down iptables only because this is a provisioning script for a Vagrant box and iptables interferes with port-forwarding
# Lets tell Puppet the order of our stages
stage {
'users': before => Stage['repos'];
'repos': before => Stage['packages'];
'packages': before => Stage['configure'];
'configure': before => Stage['services'];
'services': before => Stage['main'];
}
class services {
#we want apache
service {
'httpd':
ensure => running,
enable => true
}
service {
'iptables':
ensure => stopped,
enable => false
}
}
class configure {
# symlinking the code from /home/vagrant/public to var/www/public
exec { "public simlink":
command => "/bin/ln -s /home/vagrant/public /var/www/",
unless => "/usr/bin/test -L /var/www/",
}
file {"/var/www/index.html":
ensure => "absent"
}
}
class packages {
package {
"httpd": ensure => "present"; # Apache
"zend-server-ce-php-5.3": ensure => "present"; # Zend Server (CE)
"php-5.3-mssql-zend-server": ensure => "present"; # MSSQL Extenstion - provided by Zend
}
}
class repos {
#lets install some repos
file { "/etc/yum.repos.d/zend.repo":
content => "[Zend]
name=Zend Server
baseurl=http://repos.zend.com/zend-server/rpm/x86_64
enabled=1
gpgcheck=1
gpgkey=http://repos.zend.com/zend.key
[Zend_noarch]
name=Zend Server - noarch
baseurl=http://repos.zend.com/zend-server/rpm/noarch
enabled=1
gpgcheck=1
gpgkey=http://repos.zend.com/zend.key
"
}
}
class users
{
#add your users and groups here
group { "puppet":
ensure => "present",
}
user { "vagrant":
ensure => "present",
}
}
# Here we are linking our classes to stages
class {
# class: stage => "stagename";
users: stage => "users";
repos: stage => "repos";
packages: stage => "packages";
configure: stage => "configure";
services: stage => "services";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment