Tim Fletcher
2013-Jul-23 20:08 UTC
[Puppet Users] Enviroment variables or Java startup -D arguments
Hi All, I have been searching around for a few hours now, but don''t seem to be using the correct search terms for the answer I need. So please forgive me if this is a question that has been answered 100 times :( I have seen many questions regarding enviroment variables, but non seem to be related. Again, I may be misunderstanding the vocabulary) I am setting up SCM-Manager<https://bitbucket.org/sdorra/scm-manager/wiki/Home>(GIT/Mercurial tomcat server). It does the job for development. However, SCM-Manager requires the environment variable "SCM_HOME" to be set to save the files to. I understand that a Puppet agent executes with a minimal shell. How can I make Puppet aware of this var? This <https://bitbucket.org/sdorra/scm-manager/wiki/faq> page does offer a couple of other options (I know it offers a 3rd option, to modify the properties file, but this seems a little like cheating). The other option I tried was to add a "-DSCM_HOME=/myhome" to the start up script for tomcat, but I don''t really understand how it works, and how I would do this. The key seems to be *hiera. *But I''m unsure exactly how this works, and given the Tomcat and Java modules I''m using. My modules are: seteam-tomcat <https://github.com/puppetlabs-seteam/puppet-module-tomcat> for tomcat this requires puppetlabs-java <https://github.com/puppetlabs/puppetlabs-java> and this itself requires puppetlabs/stdlib <https://github.com/puppetlabs/puppetlabs-stdlib> My code seems rather simple (I know I''m probably doing dependencies completely wrong, but I''m just starting to be able to write me own scripts). init.pp (running inside a Vagrant box for ease) class initscm {> > include tomcat > > tomcat::war {''scm'': > > source => ''/vagrant/software/war/scm-webapp-1.32.war'', > > } > > >> } > > >> exec { "apt-get update": > > path => "/usr/bin", > > } -> > > group { "puppet": > > ensure => "present", > > } > > file { ''/etc/environment'': > > content => ''SCM_HOME=/vagrant/scm-data'' > > } > > >> >> >> class {''initscm'':} > > >> # Make sure that we update apt before getting the java package > > Exec[''apt-get update''] -> Package[''java''] > > Service[''tomcat''] -> File[''/etc/environment''] > > >Many thanks for your time, Tim -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Tim Fletcher
2013-Jul-23 22:23 UTC
[Puppet Users] Re: Enviroment variables or Java startup -D arguments
I apologise, and have though this through, and it was a silly question. This isn''t a Puppet problem at all. And sorry for the horrible script. Got a much nicer one now (using defines). Sorry for the noise. Tim ps: - I can either modify the startup service script - add the var to /etc/environment - add the var to a /etc/profile.d/ file Just making sure to notify the Service afterwards. (or reboot maybe for /etc/environment) On Tuesday, July 23, 2013 9:08:28 PM UTC+1, Tim Fletcher wrote:> > Hi All, > > I have been searching around for a few hours now, but don''t seem to be > using the correct search terms for the answer I need. So please forgive me > if this is a question that has been answered 100 times :( I have seen many > questions regarding enviroment variables, but non seem to be related. > Again, I may be misunderstanding the vocabulary) > > I am setting up SCM-Manager<https://bitbucket.org/sdorra/scm-manager/wiki/Home>(GIT/Mercurial tomcat server). It does the job for development. > > However, SCM-Manager requires the environment variable "SCM_HOME" to be > set to save the files to. I understand that a Puppet agent executes with a > minimal shell. How can I make Puppet aware of this var? > > This <https://bitbucket.org/sdorra/scm-manager/wiki/faq> page does offer > a couple of other options (I know it offers a 3rd option, to modify the > properties file, but this seems a little like cheating). The other option I > tried was to add a "-DSCM_HOME=/myhome" to the start up script for tomcat, > but I don''t really understand how it works, and how I would do this. The > key seems to be *hiera. *But I''m unsure exactly how this works, and given > the Tomcat and Java modules I''m using. > > My modules are: > seteam-tomcat <https://github.com/puppetlabs-seteam/puppet-module-tomcat> for > tomcat > this requires > puppetlabs-java <https://github.com/puppetlabs/puppetlabs-java> > and this itself requires > puppetlabs/stdlib <https://github.com/puppetlabs/puppetlabs-stdlib> > > My code seems rather simple (I know I''m probably doing dependencies > completely wrong, but I''m just starting to be able to write me own scripts). > init.pp (running inside a Vagrant box for ease) > > class initscm { >> >> include tomcat >> >> tomcat::war {''scm'': >> >> source => ''/vagrant/software/war/scm-webapp-1.32.war'', >> >> } >> >> >>> } >> >> >>> exec { "apt-get update": >> >> path => "/usr/bin", >> >> } -> >> >> group { "puppet": >> >> ensure => "present", >> >> } >> >> file { ''/etc/environment'': >> >> content => ''SCM_HOME=/vagrant/scm-data'' >> >> } >> >> >>> >>> >>> class {''initscm'':} >> >> >>> # Make sure that we update apt before getting the java package >> >> Exec[''apt-get update''] -> Package[''java''] >> >> Service[''tomcat''] -> File[''/etc/environment''] >> >> >> > Many thanks for your time, > Tim >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.