Created
November 26, 2013 20:06
-
-
Save seanhagen/7665240 to your computer and use it in GitHub Desktop.
Simple PHP Puppet setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group { 'puppet': | |
ensure => present, | |
} | |
class initial_setup { | |
exec { 'apt-get update': | |
command => '/usr/bin/apt-get update', | |
} | |
package { "essential-packages": | |
name => [ | |
"sudo", | |
"aptitude", | |
"build-essential", | |
"wget", | |
"unzip", | |
"git", | |
"strace", | |
"libmcrypt-dev", | |
"python-software-properties" | |
], | |
ensure => installed, | |
require => Exec["apt-get update"] | |
} | |
} | |
class install_php { | |
include initial_setup | |
exec { "ppa-ondrej-php5": | |
command => "/usr/bin/sudo /usr/bin/add-apt-repository ppa:ondrej/php5", | |
creates => "/etc/apt/sources.list.d/ondrej-php5-precise.list", | |
require => Package["essential-packages"] | |
} | |
exec { "apt-update-again": | |
command => "/usr/bin/apt-get update", | |
require => Exec["ppa-ondrej-php5"], | |
unless => "/usr/bin/test -f /usr/bin/php" | |
} | |
# Install PHP | |
package { "php": | |
name => [ | |
"php-pear", | |
"php5-cgi", | |
"php5-cli", | |
"php5-common", | |
"php5-curl", | |
"php5-dbg", | |
"php5-dev", | |
"php5-gd", | |
"php5-intl", | |
"php5-json", | |
"php5-mcrypt", | |
"php5-memcached", | |
"php5-mysqlnd", | |
"php5-sqlite", | |
"php5-tidy", | |
"php5-xdebug" | |
], | |
ensure => installed, | |
require => Exec['apt-update-again'] | |
} | |
} | |
class remove_apache { | |
package { 'apache2-mpm-prefork': | |
ensure => 'absent' | |
} | |
package { 'apache2-utils': | |
ensure => 'absent' | |
} | |
package { 'apache2.2-bin': | |
ensure => 'absent' | |
} | |
package { 'apache2.2-common': | |
ensure => 'absent' | |
} | |
package { 'libapache2-mod-php5': | |
ensure => 'absent' | |
} | |
} | |
class do_composer { | |
class { 'composer': | |
command_name => 'composer', | |
target_dir => '/usr/local/bin' | |
} | |
exec { '/usr/bin/ssh-keyscan -H github.com >> /home/vagrant/.ssh/known_hosts': } | |
exec { '/usr/local/bin/composer install --dev': | |
cwd => '/vagrant', | |
require => Class['composer'], | |
onlyif => '/usr/bin/test -f /vagrant/composer.json', | |
} | |
} | |
class dev { | |
include initial_setup, install_php, do_composer, remove_apache, do_composer | |
Class['initial_setup'] -> Class['remove_apache'] -> Class['install_php'] -> Class['do_composer'] | |
} | |
include dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment