Skip to content

Instantly share code, notes, and snippets.

@dougmarcey
Created November 4, 2013 23:24
Show Gist options
  • Save dougmarcey/7311112 to your computer and use it in GitHub Desktop.
Save dougmarcey/7311112 to your computer and use it in GitHub Desktop.
class hbs::solr {
service { "tomcat6":
name => "tomcat6",
ensure => running,
enable => true,
require => Package["tomcat6"],
}
package { ['tomcat6', 'tomcat6-webapps', 'tomcat6-admin-webapps', 'wget']:
ensure => present,
require => Package["java-1.7.0-openjdk"]
} ->
exec {
"download-solr" :
command => "wget --no-check-certificate http://apache.mirrors.lucidnetworks.net/lucene/solr/4.5.1/solr-4.5.1.tgz",
cwd => "/tmp",
require => [Package['wget']],
path => ['/usr/bin', '/usr/sbin',]
} ->
exec {
"unpack-solr":
command => "tar zxvf solr-4.5.1.tgz",
cwd => "/tmp",
require => [Exec['download-solr']],
path => ['/usr/bin', '/usr/sbin', '/bin']
} ->
file { "/usr/share/tomcat6/lib/jcl-over-slf4j-1.6.6.jar":
source => "/tmp/solr-4.5.1/example/lib/ext/jcl-over-slf4j-1.6.6.jar",
owner => "tomcat",
group => "tomcat"
} ->
file { "/usr/share/tomcat6/lib/jul-to-slf4j-1.6.6.jar":
source => "/tmp/solr-4.5.1/example/lib/ext/jul-to-slf4j-1.6.6.jar",
owner => "tomcat",
group => "tomcat"
} ->
file { "/usr/share/tomcat6/lib/log4j-1.2.16.jar":
source => "/tmp/solr-4.5.1/example/lib/ext/log4j-1.2.16.jar",
owner => "tomcat",
group => "tomcat"
} ->
file { "/usr/share/tomcat6/lib/slf4j-api-1.6.6.jar":
source => "/tmp/solr-4.5.1/example/lib/ext/slf4j-api-1.6.6.jar",
owner => "tomcat",
group => "tomcat"
} ->
file { "/usr/share/tomcat6/lib/slf4j-log4j12-1.6.6.jar":
source => "/tmp/solr-4.5.1/example/lib/ext/slf4j-log4j12-1.6.6.jar",
owner => "tomcat",
group => "tomcat"
} ->
file { "/usr/share/tomcat6/lib/log4j.properties":
source => "/tmp/solr-4.5.1/example/resources/log4j.properties",
owner => "tomcat",
group => "tomcat"
} ->
file { "/opt/solr":
ensure => "directory",
owner => "tomcat",
group => "tomcat"
} ->
exec { "setup-solr-home":
command => "tar -cf - . | (cd /opt/solr;tar xf -)",
cwd => "/tmp/solr-4.5.1/example/solr",
path => ['/usr/bin', '/usr/sbin', '/bin']
} ->
file { "/opt/solr/solr.war":
source => "/tmp/solr-4.5.1/dist/solr-4.5.1.war",
require => Package['tomcat6'],
owner => "tomcat",
group => "tomcat"
} ->
file { '/usr/share/tomcat6/conf/Catalina/localhost/solr.xml':
content => template('hbs/solr.xml.erb'),
owner => 'tomcat',
group => 'tomcat',
} ->
exec { "fix-solr-perms":
command => "chown -R tomcat:tomcat /opt/solr",
cwd => "/opt/solr",
path => ['/usr/bin', '/usr/sbin', '/bin']
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment