Skip to content
This repository was archived by the owner on Jan 1, 2020. It is now read-only.

Add Vagrant recipe, update main README.md and update .gitignore #287

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
nbproject
.vagrant
._*
.~lock.*
.buildpath
Expand Down
52 changes: 52 additions & 0 deletions .puppet/files/dot/.bash_aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi

__has_parent_dir () {
# Utility function so we can test for things like .git/.hg without firing
# up a separate process
test -d "$1" && return 0;

current="."
while [ ! "$current" -ef "$current/.." ]; do
if [ -d "$current/$1" ]; then
return 0;
fi
current="$current/..";
done

return 1;
}

__vcs_name() {
if [ -d .svn ]; then
echo "-[svn]";
elif __has_parent_dir ".git"; then
echo "-[$(__git_ps1 'git %s')]";
elif __has_parent_dir ".hg"; then
echo "-[hg $(hg branch)]"
fi
}

black=$(tput -Txterm setaf 0)
red=$(tput -Txterm setaf 1)
green=$(tput -Txterm setaf 2)
yellow=$(tput -Txterm setaf 3)
dk_blue=$(tput -Txterm setaf 4)
pink=$(tput -Txterm setaf 5)
lt_blue=$(tput -Txterm setaf 6)

bold=$(tput -Txterm bold)
reset=$(tput -Txterm sgr0)

export PS1='\n\[$bold\]\[$black\][\[$dk_blue\]\@\[$black\]]-[\[$green\]\u\[$yellow\]@\[$green\]\h\[$black\]]-[\[$pink\]\w\[$black\]]\[\033[0;33m\]$(__vcs_name) \[\033[00m\]\[$reset\]\n\[$reset\]\$ '

alias ls='ls -F --color=always'
alias dir='dir -F --color=always'
alias ll='ls -l'
alias cp='cp -iv'
alias rm='rm -i'
alias mv='mv -iv'
alias grep='grep --color=auto -in'
alias v='vim'
alias ..='cd ..'
130 changes: 130 additions & 0 deletions .puppet/manifests/default.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
group { 'puppet': ensure => present }
Exec { path => [ '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/' ] }
File { owner => 0, group => 0, mode => 0644 }

class {'apt':
always_apt_update => true,
}

Class['::apt::update'] -> Package <|
title != 'python-software-properties'
and title != 'software-properties-common'
|>

apt::key { '4F4EA0AAE5267A6C': }

apt::ppa { 'ppa:ondrej/php5-oldstable':
require => Apt::Key['4F4EA0AAE5267A6C']
}

class { 'puphpet::dotfiles': }

package { [
'build-essential',
'vim',
'curl',
'git-core'
]:
ensure => 'installed',
}

class { 'apache': }

apache::dotconf { 'custom':
content => 'EnableSendfile Off',
}

apache::module { 'rewrite': }

apache::vhost { 'default':
enable => false,
priority => '000',
}

apache::vhost { 'localhost':
server_name => 'localhost',
serveraliases => [
'localhost'
],
docroot => '/vagrant/public',
port => '80',
env_variables => [
],
priority => '1',
}

class { 'php':
service => 'apache',
service_autorestart => false,
module_prefix => '',
}

php::module { 'php5-mysql': }
php::module { 'php5-cli': }
php::module { 'php5-curl': }
php::module { 'php5-intl': }
php::module { 'php5-mcrypt': }

class { 'php::devel':
require => Class['php'],
}


class { 'xdebug':
service => 'apache',
}

class { 'composer':
require => Package['php5', 'curl'],
}

puphpet::ini { 'xdebug':
value => [
'xdebug.default_enable = 1',
'xdebug.remote_autostart = 0',
'xdebug.remote_connect_back = 1',
'xdebug.remote_enable = 1',
'xdebug.remote_handler = "dbgp"',
'xdebug.remote_port = 9000'
],
ini => '/etc/php5/conf.d/zzz_xdebug.ini',
notify => Service['apache'],
require => Class['php'],
}

puphpet::ini { 'php':
value => [
'date.timezone = "America/Chicago"'
],
ini => '/etc/php5/conf.d/zzz_php.ini',
notify => Service['apache'],
require => Class['php'],
}

puphpet::ini { 'custom':
value => [
'display_errors = On',
'error_reporting = -1'
],
ini => '/etc/php5/conf.d/zzz_custom.ini',
notify => Service['apache'],
require => Class['php'],
}


class { 'mysql::server':
config_hash => { 'root_password' => 'vagrant' }
}

mysql::db { 'vagrant':
grant => [
'ALL'
],
user => 'vagrant',
password => 'vagrant',
host => 'localhost',
charset => 'utf8',
require => Class['mysql::server'],
}


10 changes: 10 additions & 0 deletions .puppet/modules/apache/.fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fixtures:
repositories:
"puppi": "git://github.com/example42/puppi.git"
"monitor": "git://github.com/example42/puppet-monitor.git"
"firewall": "git://github.com/example42/puppet-firewall.git"
"iptables": "git://github.com/example42/puppet-iptables.git"
"concat": "git://github.com/example42/puppet-concat.git"
symlinks:
"apache": "#{source_dir}"

6 changes: 6 additions & 0 deletions .puppet/modules/apache/.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

puppetversion = ENV['PUPPET_VERSION']
gem 'puppet', puppetversion, :require => false
gem 'puppet-lint'
gem 'puppetlabs_spec_helper', '>= 0.1.0'
21 changes: 21 additions & 0 deletions .puppet/modules/apache/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
language: ruby
rvm:
- 1.8.7
- 1.9.3
script:
- "rake spec SPEC_OPTS='--format documentation'"
env:
- PUPPET_VERSION="~> 2.6.0"
- PUPPET_VERSION="~> 2.7.0"
- PUPPET_VERSION="~> 3.0.0"
- PUPPET_VERSION="~> 3.1.0"
matrix:
exclude:
- rvm: 1.9.3
env: PUPPET_VERSION="~> 2.6.0"
gemfile: .gemfile

gemfile: .gemfile
notifications:
email:
- [email protected]
13 changes: 13 additions & 0 deletions .puppet/modules/apache/Modulefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name 'example42-apache'
version '2.0.8'

author 'Alessandro Franceschi'
license 'Apache2'
project_page 'http://www.example42.com'
source 'https://github.com/example42/puppet-apache'
summary 'Puppet module for apache'
description 'This module installs and manages apache. Check README.rdoc for details. Puppi is required for some common functions: you can install them without using the whole module. Monitor and firewall dependencies are needed only if the relevant features are enabled'
dependency 'example42/puppi', '>=2.0.0'
dependency 'example42/yum', '>=2.0.0'
dependency 'example42/firewall', '>=2.0.0'
dependency 'example42/monitor', '>=2.0.0'
152 changes: 152 additions & 0 deletions .puppet/modules/apache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Puppet module: apache

This is a Puppet apache module from the second generation of Example42 Puppet Modules.

Made by Alessandro Franceschi / Lab42

Official site: http://www.example42.com

Official git repository: http://github.com/example42/puppet-apache

Released under the terms of Apache 2 License.

This module requires functions provided by the Example42 Puppi module.

For detailed info about the logic and usage patterns of Example42 modules read README.usage on Example42 main modules set.

## USAGE - Module specific usage

* Install apache with a custom httpd.conf template and some virtual hosts

class { 'apache':
template => 'example42/apache/httpd.conf.erb',
}

apache::vhost { 'mysite':
docroot => '/path/to/docroot',
template => 'example42/apache/vhost/mysite.com.erb',
}

## USAGE - Basic management

* Install apache with default settings

class { "apache": }

* Disable apache service.

class { "apache":
disable => true
}

* Disable apache service at boot time, but don't stop if is running.

class { "apache":
disableboot => true
}

* Remove apache package

class { "apache":
absent => true
}

* Enable auditing without without making changes on existing apache configuration files

class { "apache":
audit_only => true
}

* Install apache with a specific version

class { "apache":
version => '2.2.22'
}


## USAGE - Default server management
* Simple way to manage default apache configuration

apache::vhost { 'default':
docroot => '/var/www/document_root',
server_name => false,
priority => '',
template => 'apache/virtualhost/vhost.conf.erb',
}


## USAGE - Overrides and Customizations
* Use custom sources for main config file

class { "apache":
source => [ "puppet:///modules/lab42/apache/apache.conf-${hostname}" , "puppet:///modules/lab42/apache/apache.conf" ],
}


* Use custom source directory for the whole configuration dir

class { "apache":
source_dir => "puppet:///modules/lab42/apache/conf/",
source_dir_purge => false, # Set to true to purge any existing file not present in $source_dir
}

* Use custom template for main config file

class { "apache":
template => "example42/apache/apache.conf.erb",
}

* Define custom options that can be used in a custom template without the
need to add parameters to the apache class

class { "apache":
template => "example42/apache/apache.conf.erb",
options => {
'LogLevel' => 'INFO',
'UsePAM' => 'yes',
},
}

* Automaticallly include a custom subclass

class { "apache:"
my_class => 'apache::example42',
}


## USAGE - Example42 extensions management
* Activate puppi (recommended, but disabled by default)
Note that this option requires the usage of Example42 puppi module

class { "apache":
puppi => true,
}

* Activate puppi and use a custom puppi_helper template (to be provided separately with
a puppi::helper define ) to customize the output of puppi commands

class { "apache":
puppi => true,
puppi_helper => "myhelper",
}

* Activate automatic monitoring (recommended, but disabled by default)
This option requires the usage of Example42 monitor and relevant monitor tools modules

class { "apache":
monitor => true,
monitor_tool => [ "nagios" , "monit" , "munin" ],
}

* Activate automatic firewalling
This option requires the usage of Example42 firewall and relevant firewall tools modules

class { "apache":
firewall => true,
firewall_tool => "iptables",
firewall_src => "10.42.0.0/24",
firewall_dst => "$ipaddress_eth0",
}


[![Build Status](https://travis-ci.org/example42/puppet-apache.png?branch=master)](https://travis-ci.org/example42/puppet-apache)
Loading