Skip to content

Instantly share code, notes, and snippets.

@romaricpascal
Created March 15, 2013 14:57
Show Gist options
  • Save romaricpascal/5170424 to your computer and use it in GitHub Desktop.
Save romaricpascal/5170424 to your computer and use it in GitHub Desktop.
A Puppet manifest snippet to configure a Apache httpd vhost
# Apache configuration uses a fork of puppetlabs-apache module, available at
# https://github.com/rhumaric/puppetlabs-apache
#
# If you use the module from puppetlabs, be sure to remove
# - the `purge_vhosts_dir` parameter
# - the `setenv` parameter
# Makes sure apache is installed on the system. Leaves any vhost already
# deployed as it is.
class { 'apache':
purge_vhosts_dir => false
}
# Env module is needed to pass database configuration to Wordpress using
# environment variables
a2mod { 'env':
name => 'env',
ensure => 'present'
}
# Rewrite module is necessary to have custom permalinks in Wordpress
a2mod { 'rewrite':
name => 'rewrite',
ensure => 'present'
}
# Creates the vhost, passing along the necessary mysql information
apache::vhost{ 'awesome-project':
name => 'awesome-project.local',
port => 80,
docroot => '/var/vhosts/awesome-project',
configure_firewall => false,
servername => 'awesome-project.local',
ssl => false,
override => all,
setenv => {
'WORDPRESS_DB_USER' => 'awesome-project',
'WORDPRESS_DB_PASSWORD' => '@we5omE-pAs5w0rD',
'WORDPRESS_DB_HOST' => 'localhost',
'WORDPRESS_DB_NAME' => 'awesome-project.local'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment