Clean up puppet (deploy LAMP / setup app config)

Implements: blueprint openid-oauth2-infra-implementation-puppet-script

Prepares a raw server with all software stack needed to run
openstackid project:

* installs PHP
* installs Apache
* installs Redis Server
* creates a initial environment configuration for laravel application
  (using *.erb templates)

Change-Id: If6216da0d70a45609076e8111a67055dbc87c9e4
This commit is contained in:
smarcet 2014-01-28 13:03:39 -03:00 committed by Sebastian Marcet
parent 9535f444fa
commit 0f1f7844ba
5 changed files with 32 additions and 79 deletions

View File

@ -18,14 +18,14 @@
class redis(
$redis_port = '6379',
$redis_max_memory = '1gb',
$redis_bind = '127.0.0.1',
$redis_bin_dir = '/usr/bin',
$redis_password = '',
$redis_max_memory = '1gb',
$version = '2.2.12',
) {
package {'redis-server':
ensure => installed,
ensure => present,
}
case $version {
@ -43,31 +43,20 @@ class redis(
}
}
file { '/etc/init.d/redis-server':
ensure => present,
owner => 'root',
group => 'root',
mode => '0755',
require => Package['redis-server'],
content => template('redis/init_script.erb'),
}
file { '/etc/redis/redis.conf':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => template("redis/${redis_conf_file}"),
require => Package['redis-server'],
notify => Service['redis-server'],
}
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
replace => true,
content => template("redis/${redis_conf_file}"),
require => Package['redis-server'],
}
service { 'redis-server':
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
require => [ File['/etc/redis/redis.conf'], File['/etc/init.d/redis-server'], Package['redis-server'] ],
}
service { 'redis-server':
ensure => running,
require => Package['redis-server'],
subscribe => File['/etc/redis/redis.conf'],
}
}
}

View File

@ -1,42 +0,0 @@
#!/bin/sh
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
REDISPORT="<%= redis_port %>"
EXEC=<%= redis_bin_dir %>/redis-server
CLIEXEC=<%= redis_bin_dir %>/redis-cli
PIDFILE=/var/run/redis.pid
CONF="/etc/redis/redis.conf"
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -p $REDISPORT shutdown
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
*)
echo "Please use start or stop as first argument"
;;
esac

View File

@ -14,7 +14,7 @@
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize no
daemonize yes
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
@ -49,7 +49,7 @@ loglevel verbose
# Specify the log file name. Also 'stdout' can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile stdout
logfile /var/log/redis/redis-server.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@ -147,7 +147,9 @@ slave-serve-stale-data yes
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
# requirepass foobared
<% if redis_password != "" %>
requirepass <%= redis_password %>
<% end %>
# Command renaming.
#

View File

@ -14,7 +14,7 @@
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize no
daemonize yes
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
@ -50,7 +50,7 @@ loglevel verbose
# Specify the log file name. Also 'stdout' can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile stdout
logfile /var/log/redis/redis-server.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@ -178,7 +178,9 @@ slave-priority 100
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
# requirepass foobared
<% if redis_password != "" %>
requirepass <%= redis_password %>
<% end %>
# Command renaming.
#

View File

@ -14,7 +14,7 @@
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize no
daemonize yes
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
# default. You can specify a custom pid file location here.
@ -61,7 +61,7 @@ tcp-keepalive 0
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
loglevel notice
logfile /var/log/redis/redis-server.log
# Specify the log file name. Also 'stdout' can be used to force
# Redis to log on the standard output. Note that if you use standard
@ -255,7 +255,9 @@ slave-priority 100
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
# requirepass foobared
<% if redis_password != "" %>
requirepass <%= redis_password %>
<% end %>
# Command renaming.
#