Monday, 8 June 2015

Tomcat Cookbook

#
# Cookbook Name:: tomcat
# Recipe:: default
#
# Copyright 2015, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute


tomcat_base="#{node['tomcat']['basedir']}"
tomcat_user="#{node['tomcat']['user']}"


user tomcat_user do
        shell '/bin/false'
        action :create
        not_if  "grep #{node['tomcat']['user']} /etc/passwd", :user => "#{node['tomcat']['user']}"
end

directory tomcat_base do
        owner tomcat_user
        group tomcat_user
        mode "0755"
        action :create
        recursive true
        not_if { File.exist?("#{node['tomcat']['basedir']}") }
end


remote_file "/tmp/tomcat.tar.gz" do
        #source 'http://10.72.6.182/tars/mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz'
        source 'ftp://192.168.33.10/pub/apache-tomcat-7.0.59.tar.gz'
        path "/tmp/tomcat.tar.gz"
        not_if { File.exist?("/tmp/tomcat.tar.gz") }
        end


execute "Extracting source" do
        command <<-EOH
        tar -zxvf /tmp/tomcat.tar.gz -C #{node['tomcat']['basedir']}/
        EOH
        not_if { File.exist?("/MSVOL/apache-tomcat-7.0.59") }
end

#Executing environment  variable

bash "Exporting catalina variable" do
        code <<-EOH
        cp  /etc/profile /etc/profile_orig
        cat >> /etc/profile <<-EOH1
        export CATALINA_BASE=#{node['tomcat']['home']}
        export CATALINA_HOME=#{node['tomcat']['home']}
        export CATALINA_TMPDIR=#{node['tomcat']['home']}/TEMP
        export CLASSPATH=#{node['tomcat']['home']}/bootstrap.jar:#{node['tomcat']['home']}/bin/tomcat-juli.jar
        EOH1
        EOH
        not_if { File.exist?("/etc/profile_orig") }
end




1 comment:

  1. Here is Mr Benjamin contact Email details, 247officedept@gmail.com. /  Or Whatsapp +1 989-394-3740 that helped me with loan of 90,000.00 Euros to startup my business and I'm very grateful,It was really hard on me here trying to make a way as a single mother things hasn't be easy with me but with the help of Mr Benjamin put smile on my face as i watch my business growing stronger and expanding as well.I know you may surprise why me putting things like this here but i really have to express my gratitude so anyone seeking for financial help or going through hardship with there business or want to startup business project can see to this and have hope of getting out of the hardship..Thank You.

    ReplyDelete