Hi Brian,
below is my updated init.pp file. but i am getting the error as
Apr 12 14:49:51 pil-vm-pup-01 puppet-master[14586]:
(//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog from remote
server: Error 400 on SERVER: Could not find class dev_jboss_jeeva for
vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/jeeva_base.pp:2 on
node vm-jeeva2.aircell.prod
Apr 12 14:49:51 pil-vm-pup-01 puppet-master[14586]:
(//vm-jeeva2.aircell.prod/Puppet) Using cached catalog
Apr 12 14:49:51 pil-vm-pup-01 puppet-master[14586]:
(//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog; skipping run
my init.pp file
class dev_jboss_jeeva {
exec {
onlyif => "test -d /opt/xyz"
file { "/opt/xyz/file.txt":
owner => "jboss",
group => "jboss",
source => "puppet://$puppetserver/modules/module_name/opt/xyz/file.txt",
}
}
}
Thanks,
Jeeva
On Thu, Apr 12, 2012 at 9:24 AM, Brian Gallew <[email protected]> wrote:
> Another alternative is to unconditionally copy the file to a staging
> director (e.g. /var/staging) and then have
>
> exec {
> "conditional copy to path1":
> onlyif => "test -d /opt/path1"
> command => "rsync -a /var/staging/file.txt /opt/path1";
> "conditional copy to path2":
> onlyif => "test -d /opt/path2"
> command => "rsync -a /var/staging/file.txt /opt/path2";
> "conditional copy to path3":
> onlyif => "test -d /opt/path3"
> command => "rsync -a /var/staging/file.txt /opt/path3";
> }
>
> For neatness' sake, you could turn that into a define{}
>
> On Thu, Apr 12, 2012 at 7:18 AM, Munna S <[email protected]> wrote:
>
>> Hi Gary,
>>
>> I created a custom fact path_to_check.rb and placed it under
>> .../module_name/lib/facter
>>
>> below is my init.pp file
>>
>> class class_name
>> if $path_to_check == present{
>> file { "/opt/xyz/file.txt":
>> owner => "jboss",
>> group => "jboss",
>> source =>
>> "puppet://$puppetserver/modules/module_name/opt/xyz/file.txt",
>> }
>> }
>> }
>> But i dont see files are getting pushed
>> On Sun, Apr 1, 2012 at 11:08 PM, Munna S <[email protected]> wrote:
>>
>>> Thank you so much Gary. I will try this
>>>
>>> Thanks,
>>> Jeeva
>>>
>>> On Sun, Apr 1, 2012 at 11:05 PM, Gary Larizza <[email protected]>wrote:
>>>
>>>> Jeeva,
>>>>
>>>> Your custom fact would do something like:
>>>> File.directory?('/path/to/check') that returns true or false depending on
>>>> whether the directory existed. Your fact would return a true or false
>>>> value (so if the custom fact were named 'path_to_x' you would do something
>>>> like this in your init.pp
>>>>
>>>> if $path_to_x == 'true' {
>>>> # Do something here
>>>> } else {
>>>> # Do something else here
>>>> }
>>>>
>>>> Do this for every custom fact (corresponding to the paths you want to
>>>> check) in your manifest, or combine them into one giant if statement like:
>>>>
>>>> if ($path_to_x == 'true') or ($path_to_y == 'true') {
>>>> # Do something
>>>> }
>>>>
>>>> Does this make sense?
>>>>
>>>>
>>>> On Sun, Apr 1, 2012 at 8:48 PM, Munna S <[email protected]> wrote:
>>>>
>>>>> Hi Gary,
>>>>>
>>>>> How i can put this in my init.pp file. Actually i am checking for the
>>>>> path. if path found then copy the file else dont create any file/folder.
>>>>> So
>>>>> here i need to check for 3 different path on each server. if any of the
>>>>> below path exist then copy the file.
>>>>>
>>>>> Thanks,
>>>>> Jeeva
>>>>>
>>>>> On Sun, Apr 1, 2012 at 10:41 PM, Gary Larizza <[email protected]>wrote:
>>>>>
>>>>>> Jeeva,
>>>>>>
>>>>>>
>>>>>> I would make a custom fact (
>>>>>> http://docs.puppetlabs.com/guides/custom_facts.html) that checks for
>>>>>> the presence of these files. Your Puppet manifest would check the
>>>>>> condition of this fact to ensure the file absent or present (i.e. if
>>>>>> $custom_fact { file { '/path/to/file': ensure => file } } ).
>>>>>>
>>>>>>
>>>>>> Does that make sense?
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Apr 1, 2012 at 8:37 PM, Munna S <[email protected]> wrote:
>>>>>>
>>>>>>> Team,
>>>>>>>
>>>>>>> Any help
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Jeeva
>>>>>>>
>>>>>>> On Fri, Mar 30, 2012 at 12:51 PM, Munna S <[email protected]>wrote:
>>>>>>>
>>>>>>>> Team,
>>>>>>>>
>>>>>>>> I need a puppet module to copy a file to different location based
>>>>>>>> on condition check . Below is my requirement
>>>>>>>>
>>>>>>>> if /opt/path1 found on the server then copy file1
>>>>>>>> if /opt/path2 found on the server then copy file1
>>>>>>>> if /opt/path3 found on the server then copy file1
>>>>>>>>
>>>>>>>> if none of the above path found then dont copy file1
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Jeeva
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Puppet Users" group.
>>>>>>> To post to this group, send email to [email protected].
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> [email protected].
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/puppet-users?hl=en.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Gary Larizza
>>>>>> Professional Services Engineer
>>>>>> Puppet Labs
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Puppet Users" group.
>>>>>> To post to this group, send email to [email protected].
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected].
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/puppet-users?hl=en.
>>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Puppet Users" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected].
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/puppet-users?hl=en.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Gary Larizza
>>>> Professional Services Engineer
>>>> Puppet Labs
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Puppet Users" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/puppet-users?hl=en.
>>>>
>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.