Ask Your Question
0

i want to write class to stage a war file with parameter passing from puppet console.

asked 2015-01-20 14:41:00 -0500

singaravelan gravatar image

I need help for writing a class to deploy a war file to webserver , condition war file name and war file source location should be passed as parameter viz puppet console in the specified class .

your suggestion and response much appreciated.

Thanks Singaravelan Ranganathan

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-01-20 15:46:11 -0500

singaravelan gravatar image

updated 2015-01-20 16:04:06 -0500

GregLarkin gravatar image

Thanks Greg. I have installed the staging module for software installing module, so just i have created new manifest called deployapp under that i have created init.pp file. below is the content of the init file to deploy war to a node connects with PE.

include staging
staging::deploy {$war_name:
  source => $war_source,
  target => $deploy_path
}

[root@puppet manifests]# pwd
/etc/puppetlabs/puppet/environments/production/modules/deployapp/manifests
[root@puppet manifests]# /opt/puppet/bin/puppet apply init.pp --noop
Error: staging::file: do not recognize source . at /etc/puppetlabs/puppet/environments/production/modules/staging/manifests/file.pp:117 on node puppet.whplabs.com
Error: staging::file: do not recognize source . at /etc/puppetlabs/puppet/environments/production/modules/staging/manifests/file.pp:117 on node puppet.whplabs.com
[root@puppet manifests]#

Can you help me figure it out.

edit flag offensive delete link more

Comments

What are the values of $war_name, $war_source, and $deploy_path passed to your code?

GregLarkin gravatar imageGregLarkin ( 2015-01-20 16:05:01 -0500 )edit

No . I want to pass those values via Pe console class parameter.

singaravelan gravatar imagesingaravelan ( 2015-01-20 16:07:30 -0500 )edit

Do you mean this way ? staging::deploy { 'sample.tar.gz': source => 'puppet:///modules/staging/sample.tar.gz', target => '/usr/local', } i dont want pass the parameter in the init.pp or any file in the PE server. I have pass the values using class module parameters in the console, so war file

singaravelan gravatar imagesingaravelan ( 2015-01-20 16:09:52 -0500 )edit

so that war file pushed to the group nodes in the group. ex app1 ,app2

singaravelan gravatar imagesingaravelan ( 2015-01-20 16:10:29 -0500 )edit

Sure, but you have to supply those parameters when using puppet apply because the puppet master/console is not involved. The typical way to do that is create a unit test file in the tests/ subdirectory of your module and add some test values for those parameters.

GregLarkin gravatar imageGregLarkin ( 2015-01-20 16:18:57 -0500 )edit
0

answered 2015-01-20 15:02:08 -0500

GregLarkin gravatar image

Absolutely, you can use the nanliu-staging module, write a wrapper class around it to accept a parameter from the console. Classify your node with your wrapper class, set the parameter to what you want in the console and job done.

edit flag offensive delete link more

Comments

i created class, it is not working . can you check this Error: staging::file: do not recognize source . at /etc/puppetlabs/puppet/environments/production/modules/staging/manifests/file.pp:117 on node puppet.whplabs.com Error: staging::file: do not recognize source . at /etc/puppetlabs/puppet/envir

singaravelan gravatar imagesingaravelan ( 2015-01-20 16:05:03 -0500 )edit

Thanks Greg. I have installed the staging module for software installing module, so just i have created new manifest called deployapp under that i have created init.pp file. below is the content of the init file to deploy war to a node connects with PE. include staging staging::deploy {$warname: so

singaravelan gravatar imagesingaravelan ( 2015-01-20 16:05:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-01-20 14:41:00 -0500

Seen: 392 times

Last updated: Jan 20 '15