Hi Warron, 

Thanks for your response. Yes, i looked up puppet manual pages and found 
syntax. But what I can't find is how to put command execution syntax inside 
loop. 

Let me hop on to slack.puppet.com 
<http://www.google.com/url?q=http%3A%2F%2Fslack.puppet.com&sa=D&sntz=1&usg=AFQjCNHBFHR6L44ZtHa3Eg04l3AG3tSyXw>
 
to get help as well. 

Thanks!

On Monday, May 1, 2017 at 7:21:46 PM UTC-7, Warron French wrote:
>
> Samir, are you aware of the slack.puppet.com 
> <http://www.google.com/url?q=http%3A%2F%2Fslack.puppet.com&sa=D&sntz=1&usg=AFQjCNHBFHR6L44ZtHa3Eg04l3AG3tSyXw>
>  
> website?  It is free and you can chat/IM with people real-time about your 
> code.  That's the first thing.
>
> Secondly are you aware of the Puppet.com pages for code writing?  Check 
> this page: https://docs.puppet.com/puppet/4.9/lang_conditional.html or 
> this page - 
> https://docs.puppet.com/puppet/4.9/lang_conditional.html#if-statements
>
> Change the version drop-down box to match your Puppet Server version?
>
> Also, are you aware of the builtin Puppet facts that you can use?  You 
> mentioned that you are using $env variable "from?" hostname, there is a 
> facter (fact) for hostname; are you aware of that?
>
> I too am relatively newbie, but I am getting better with every new and 
> challenging module I write.
>
> Finally, what error are you getting when you use this module?  Copy/paste 
> the output as the result of *puppet parser validate *
> */path/to/your/module/manifest/init.pp*  (or whatever your .PP file is 
> called).
>
>
> --------------------------
> Warron French
>
>
> On Mon, May 1, 2017 at 7:36 PM, Samir Gahirwal <[email protected] 
> <javascript:>> wrote:
>
>> Hi, 
>>
>> I am very new to puppet and writing my first class :) Please pardon me 
>> for asking basic question 
>>
>> I am trying to write module to run install script. Can someone help me 
>> with syntax or suggest better way to code following 
>>
>> define install-package {
>> if ( $env != 'test' or $env != 'qa') {
>>             case $::package_type {
>>                 'abc': {
>>                     $variable = '123'
>>                       }
>>                 'xyz': {
>>                     $variable = '345'
>>                       }
>>    exec {"run_my_script":
>>           source => "puppet:///modules/mymodule/resources/myinstall
>> script.sh",
>>           command => 'sh myscript.sh $variable'
>>         }
>>  
>>              }
>> else {
>>             case $::package_type {
>>                 'abc': {
>>                     $variable = '567'
>>                       }
>>                 'xyz': {
>>                     $variable = '789'
>>                       }
>>              }
>>    exec {"run_my_script":
>>           source => "puppet:///modules/mymodule/resources/myinstall
>> script.sh",
>>           command => 'sh myscript.sh $variable'
>>         }
>> }
>>
>> class mymodule::software {
>>     $package_type = unique([jdk,apache,tomcat])
>>     install-package { $package_type:; }
>> }
>>
>> I am deriving env variable from host name.
>>
>> Let me know if you need additional details.
>>
>> Thanks!
>> --SamirG
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/puppet-users/ecb68180-af56-4d36-a555-236a69efea50%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/puppet-users/ecb68180-af56-4d36-a555-236a69efea50%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/19653bb7-cc35-4e2a-89c1-f601bc3d8ece%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to