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

Commit 24fd8ea

Browse files
committed
Add Vagrant recipe, update main README.md and update .gitignore
1 parent e2e1c69 commit 24fd8ea

File tree

509 files changed

+30254
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

509 files changed

+30254
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
nbproject
2+
.vagrant
23
._*
34
.~lock.*
45
.buildpath

.puppet/files/dot/.bash_aliases

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
if [ -f /etc/bash_completion ]; then
2+
source /etc/bash_completion
3+
fi
4+
5+
__has_parent_dir () {
6+
# Utility function so we can test for things like .git/.hg without firing
7+
# up a separate process
8+
test -d "$1" && return 0;
9+
10+
current="."
11+
while [ ! "$current" -ef "$current/.." ]; do
12+
if [ -d "$current/$1" ]; then
13+
return 0;
14+
fi
15+
current="$current/..";
16+
done
17+
18+
return 1;
19+
}
20+
21+
__vcs_name() {
22+
if [ -d .svn ]; then
23+
echo "-[svn]";
24+
elif __has_parent_dir ".git"; then
25+
echo "-[$(__git_ps1 'git %s')]";
26+
elif __has_parent_dir ".hg"; then
27+
echo "-[hg $(hg branch)]"
28+
fi
29+
}
30+
31+
black=$(tput -Txterm setaf 0)
32+
red=$(tput -Txterm setaf 1)
33+
green=$(tput -Txterm setaf 2)
34+
yellow=$(tput -Txterm setaf 3)
35+
dk_blue=$(tput -Txterm setaf 4)
36+
pink=$(tput -Txterm setaf 5)
37+
lt_blue=$(tput -Txterm setaf 6)
38+
39+
bold=$(tput -Txterm bold)
40+
reset=$(tput -Txterm sgr0)
41+
42+
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\]\$ '
43+
44+
alias ls='ls -F --color=always'
45+
alias dir='dir -F --color=always'
46+
alias ll='ls -l'
47+
alias cp='cp -iv'
48+
alias rm='rm -i'
49+
alias mv='mv -iv'
50+
alias grep='grep --color=auto -in'
51+
alias v='vim'
52+
alias ..='cd ..'

.puppet/manifests/default.pp

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
group { 'puppet': ensure => present }
2+
Exec { path => [ '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/' ] }
3+
File { owner => 0, group => 0, mode => 0644 }
4+
5+
class {'apt':
6+
always_apt_update => true,
7+
}
8+
9+
Class['::apt::update'] -> Package <|
10+
title != 'python-software-properties'
11+
and title != 'software-properties-common'
12+
|>
13+
14+
apt::key { '4F4EA0AAE5267A6C': }
15+
16+
apt::ppa { 'ppa:ondrej/php5-oldstable':
17+
require => Apt::Key['4F4EA0AAE5267A6C']
18+
}
19+
20+
class { 'puphpet::dotfiles': }
21+
22+
package { [
23+
'build-essential',
24+
'vim',
25+
'curl',
26+
'git-core'
27+
]:
28+
ensure => 'installed',
29+
}
30+
31+
class { 'apache': }
32+
33+
apache::dotconf { 'custom':
34+
content => 'EnableSendfile Off',
35+
}
36+
37+
apache::module { 'rewrite': }
38+
39+
apache::vhost { 'default':
40+
enable => false,
41+
priority => '000',
42+
}
43+
44+
apache::vhost { 'localhost':
45+
server_name => 'localhost',
46+
serveraliases => [
47+
'localhost'
48+
],
49+
docroot => '/vagrant/public',
50+
port => '80',
51+
env_variables => [
52+
],
53+
priority => '1',
54+
}
55+
56+
class { 'php':
57+
service => 'apache',
58+
service_autorestart => false,
59+
module_prefix => '',
60+
}
61+
62+
php::module { 'php5-mysql': }
63+
php::module { 'php5-cli': }
64+
php::module { 'php5-curl': }
65+
php::module { 'php5-intl': }
66+
php::module { 'php5-mcrypt': }
67+
68+
class { 'php::devel':
69+
require => Class['php'],
70+
}
71+
72+
73+
class { 'xdebug':
74+
service => 'apache',
75+
}
76+
77+
class { 'composer':
78+
require => Package['php5', 'curl'],
79+
}
80+
81+
puphpet::ini { 'xdebug':
82+
value => [
83+
'xdebug.default_enable = 1',
84+
'xdebug.remote_autostart = 0',
85+
'xdebug.remote_connect_back = 1',
86+
'xdebug.remote_enable = 1',
87+
'xdebug.remote_handler = "dbgp"',
88+
'xdebug.remote_port = 9000'
89+
],
90+
ini => '/etc/php5/conf.d/zzz_xdebug.ini',
91+
notify => Service['apache'],
92+
require => Class['php'],
93+
}
94+
95+
puphpet::ini { 'php':
96+
value => [
97+
'date.timezone = "America/Chicago"'
98+
],
99+
ini => '/etc/php5/conf.d/zzz_php.ini',
100+
notify => Service['apache'],
101+
require => Class['php'],
102+
}
103+
104+
puphpet::ini { 'custom':
105+
value => [
106+
'display_errors = On',
107+
'error_reporting = -1'
108+
],
109+
ini => '/etc/php5/conf.d/zzz_custom.ini',
110+
notify => Service['apache'],
111+
require => Class['php'],
112+
}
113+
114+
115+
class { 'mysql::server':
116+
config_hash => { 'root_password' => 'vagrant' }
117+
}
118+
119+
mysql::db { 'vagrant':
120+
grant => [
121+
'ALL'
122+
],
123+
user => 'vagrant',
124+
password => 'vagrant',
125+
host => 'localhost',
126+
charset => 'utf8',
127+
require => Class['mysql::server'],
128+
}
129+
130+

.puppet/modules/apache/.fixtures.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
fixtures:
2+
repositories:
3+
"puppi": "git://github.com/example42/puppi.git"
4+
"monitor": "git://github.com/example42/puppet-monitor.git"
5+
"firewall": "git://github.com/example42/puppet-firewall.git"
6+
"iptables": "git://github.com/example42/puppet-iptables.git"
7+
"concat": "git://github.com/example42/puppet-concat.git"
8+
symlinks:
9+
"apache": "#{source_dir}"
10+

.puppet/modules/apache/.gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
puppetversion = ENV['PUPPET_VERSION']
4+
gem 'puppet', puppetversion, :require => false
5+
gem 'puppet-lint'
6+
gem 'puppetlabs_spec_helper', '>= 0.1.0'

.puppet/modules/apache/.travis.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: ruby
2+
rvm:
3+
- 1.8.7
4+
- 1.9.3
5+
script:
6+
- "rake spec SPEC_OPTS='--format documentation'"
7+
env:
8+
- PUPPET_VERSION="~> 2.6.0"
9+
- PUPPET_VERSION="~> 2.7.0"
10+
- PUPPET_VERSION="~> 3.0.0"
11+
- PUPPET_VERSION="~> 3.1.0"
12+
matrix:
13+
exclude:
14+
- rvm: 1.9.3
15+
env: PUPPET_VERSION="~> 2.6.0"
16+
gemfile: .gemfile
17+
18+
gemfile: .gemfile
19+
notifications:
20+
email:
21+

.puppet/modules/apache/Modulefile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name 'example42-apache'
2+
version '2.0.8'
3+
4+
author 'Alessandro Franceschi'
5+
license 'Apache2'
6+
project_page 'http://www.example42.com'
7+
source 'https://github.com/example42/puppet-apache'
8+
summary 'Puppet module for apache'
9+
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'
10+
dependency 'example42/puppi', '>=2.0.0'
11+
dependency 'example42/yum', '>=2.0.0'
12+
dependency 'example42/firewall', '>=2.0.0'
13+
dependency 'example42/monitor', '>=2.0.0'

.puppet/modules/apache/README.md

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Puppet module: apache
2+
3+
This is a Puppet apache module from the second generation of Example42 Puppet Modules.
4+
5+
Made by Alessandro Franceschi / Lab42
6+
7+
Official site: http://www.example42.com
8+
9+
Official git repository: http://github.com/example42/puppet-apache
10+
11+
Released under the terms of Apache 2 License.
12+
13+
This module requires functions provided by the Example42 Puppi module.
14+
15+
For detailed info about the logic and usage patterns of Example42 modules read README.usage on Example42 main modules set.
16+
17+
## USAGE - Module specific usage
18+
19+
* Install apache with a custom httpd.conf template and some virtual hosts
20+
21+
class { 'apache':
22+
template => 'example42/apache/httpd.conf.erb',
23+
}
24+
25+
apache::vhost { 'mysite':
26+
docroot => '/path/to/docroot',
27+
template => 'example42/apache/vhost/mysite.com.erb',
28+
}
29+
30+
## USAGE - Basic management
31+
32+
* Install apache with default settings
33+
34+
class { "apache": }
35+
36+
* Disable apache service.
37+
38+
class { "apache":
39+
disable => true
40+
}
41+
42+
* Disable apache service at boot time, but don't stop if is running.
43+
44+
class { "apache":
45+
disableboot => true
46+
}
47+
48+
* Remove apache package
49+
50+
class { "apache":
51+
absent => true
52+
}
53+
54+
* Enable auditing without without making changes on existing apache configuration files
55+
56+
class { "apache":
57+
audit_only => true
58+
}
59+
60+
* Install apache with a specific version
61+
62+
class { "apache":
63+
version => '2.2.22'
64+
}
65+
66+
67+
## USAGE - Default server management
68+
* Simple way to manage default apache configuration
69+
70+
apache::vhost { 'default':
71+
docroot => '/var/www/document_root',
72+
server_name => false,
73+
priority => '',
74+
template => 'apache/virtualhost/vhost.conf.erb',
75+
}
76+
77+
78+
## USAGE - Overrides and Customizations
79+
* Use custom sources for main config file
80+
81+
class { "apache":
82+
source => [ "puppet:///modules/lab42/apache/apache.conf-${hostname}" , "puppet:///modules/lab42/apache/apache.conf" ],
83+
}
84+
85+
86+
* Use custom source directory for the whole configuration dir
87+
88+
class { "apache":
89+
source_dir => "puppet:///modules/lab42/apache/conf/",
90+
source_dir_purge => false, # Set to true to purge any existing file not present in $source_dir
91+
}
92+
93+
* Use custom template for main config file
94+
95+
class { "apache":
96+
template => "example42/apache/apache.conf.erb",
97+
}
98+
99+
* Define custom options that can be used in a custom template without the
100+
need to add parameters to the apache class
101+
102+
class { "apache":
103+
template => "example42/apache/apache.conf.erb",
104+
options => {
105+
'LogLevel' => 'INFO',
106+
'UsePAM' => 'yes',
107+
},
108+
}
109+
110+
* Automaticallly include a custom subclass
111+
112+
class { "apache:"
113+
my_class => 'apache::example42',
114+
}
115+
116+
117+
## USAGE - Example42 extensions management
118+
* Activate puppi (recommended, but disabled by default)
119+
Note that this option requires the usage of Example42 puppi module
120+
121+
class { "apache":
122+
puppi => true,
123+
}
124+
125+
* Activate puppi and use a custom puppi_helper template (to be provided separately with
126+
a puppi::helper define ) to customize the output of puppi commands
127+
128+
class { "apache":
129+
puppi => true,
130+
puppi_helper => "myhelper",
131+
}
132+
133+
* Activate automatic monitoring (recommended, but disabled by default)
134+
This option requires the usage of Example42 monitor and relevant monitor tools modules
135+
136+
class { "apache":
137+
monitor => true,
138+
monitor_tool => [ "nagios" , "monit" , "munin" ],
139+
}
140+
141+
* Activate automatic firewalling
142+
This option requires the usage of Example42 firewall and relevant firewall tools modules
143+
144+
class { "apache":
145+
firewall => true,
146+
firewall_tool => "iptables",
147+
firewall_src => "10.42.0.0/24",
148+
firewall_dst => "$ipaddress_eth0",
149+
}
150+
151+
152+
[![Build Status](https://travis-ci.org/example42/puppet-apache.png?branch=master)](https://travis-ci.org/example42/puppet-apache)

0 commit comments

Comments
 (0)