[Puppet Users] Re: Need puppet module for condition copy
It's definitely a class loading problem and I don't think Jeeva is using modules at all. Jeeva: Could you pls try the things I said in my previous post and see if that works? Cheers!! On Monday, April 16, 2012 1:34:31 AM UTC+1, Wil Cooley wrote: On Apr 13, 10:49 am, Munna S 19.mu...@gmail.com wrote: I followed your steps. now i am getting below error Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: Could not find class dev_jboss_jeeva for vm-jeeva2.aircell.prod at ... i have jeeva_base.pp file under /etc/puppet/manifests/nodes and below is its content node jeeva_base { include dev_jboss_jeeva} -- also i have a another .pp file by name vm-jeeva2 under /etc/puppet/manifests/nodes and below is its content. we have seperate .pp file for each server name. one server is vm-jeeva2. -- node vm-jeeva2 inherits jeeva_base {} what could be the problem ? Where is the class dev_jboss_jeeva defined? You mentioned above an 'init.pp', which would be usual if you were using modules, but it does not seem like you are using modules. It sounds like the problem you are having is wholly outside of the complicated machinations of what you're trying to do. It looks more like you have a much simpler class-loading problem. Here are a few things to try: * Comment out all of the stuff from dev_jboss_jeeva and replace it with a warning function call, to log that everything is working right: class dev_jboss_jeeva { warning(dev_jboss_jeeva has successfully loaded) } * Copy your class dev_jboss_jeeva { ... } right before the node jeeva_base and see if you see your warning message (I suggest warning instead of info because info sometimes requires using --verbose on the command line; warning will always show): class dev_jboss_jeeva { warning(dev_jboss_jeeva was here) } node jeeva_base { include dev_jboss_jeeva } If you see the message with the class defined right before the node, but not wherever else you have it, then you know the problem is that it is unable to actually find the class and you should give specifics about that instead. Wil -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/_Puid9FxhfAJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
Hi Sans i am trying it now. will let you know the output soon. Also in my site.pp i have the below content import 'nodes/*' $puppetserver = 'puppet-server.domain.com' I do have many modules , which works as expected. Thanks, Jeeva cat /etc/puppet/manifests/site.pp On Mon, Apr 16, 2012 at 5:36 AM, Sans r.santanu@gmail.com wrote: It's definitely a class loading problem and I don't think Jeeva is using modules at all. Jeeva: Could you pls try the things I said in my previous post and see if that works? Cheers!! On Monday, April 16, 2012 1:34:31 AM UTC+1, Wil Cooley wrote: On Apr 13, 10:49 am, Munna S 19.mu...@gmail.com wrote: I followed your steps. now i am getting below error Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: Could not find class dev_jboss_jeeva for vm-jeeva2.aircell.prod at ... i have jeeva_base.pp file under /etc/puppet/manifests/nodes and below is its content --**-- node jeeva_base { include dev_jboss_jeeva} --** also i have a another .pp file by name vm-jeeva2 under /etc/puppet/manifests/nodes and below is its content. we have seperate .pp file for each server name. one server is vm-jeeva2. -- node vm-jeeva2 inherits jeeva_base {} what could be the problem ? Where is the class dev_jboss_jeeva defined? You mentioned above an 'init.pp', which would be usual if you were using modules, but it does not seem like you are using modules. It sounds like the problem you are having is wholly outside of the complicated machinations of what you're trying to do. It looks more like you have a much simpler class-loading problem. Here are a few things to try: * Comment out all of the stuff from dev_jboss_jeeva and replace it with a warning function call, to log that everything is working right: class dev_jboss_jeeva { warning(dev_jboss_jeeva has successfully loaded) } * Copy your class dev_jboss_jeeva { ... } right before the node jeeva_base and see if you see your warning message (I suggest warning instead of info because info sometimes requires using --verbose on the command line; warning will always show): class dev_jboss_jeeva { warning(dev_jboss_jeeva was here) } node jeeva_base { include dev_jboss_jeeva } If you see the message with the class defined right before the node, but not wherever else you have it, then you know the problem is that it is unable to actually find the class and you should give specifics about that instead. Wil -- You received this message because you are subscribed to the Google Groups Puppet Users group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/_Puid9FxhfAJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
Hi Sans, I followed your steps, but i am getting the same error again Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/Puppet) Using cached catalog Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog; skipping run @All, Just not to confuse anyone, currently my puppet server is working as expected. i have lot of modules created and it works. This is how my configuration is 1 ) my site.pp file is under /etc/puppet/manifest/site.pp and below is my content import 'nodes/*' $puppetserver = 'puppet-server.domain.com' 2) All my modules is under below path /etc/puppet/modules/ 3) under below path i have all my .pp files . eg /etc/puppet/manifests/nodes/server1.pp /etc/puppet/manifests/nodes/server2.pp /etc/puppet/manifests/nodes/server3.pp /etc/puppet/manifests/nodes/server4.pp addition to this i have a jeeva_base.pp file where i include all my modules. below is the portion of its content --- node jeeva_base { include all_scripts include dev_jboss_jeeva } --- below is the content of my server1.pp file . i have created individual .pp file for each server which inherits jeeva_base node. -- node server1 inherits jeeva_base { } --- As i said above, this is my requirement. we have 3 version of jboss running in our environment in different servers. eg. jboss4 in server1, jboss5 in server2 , jboss6 in server3 , and no jboss in server 4 , etc on each server, jboss config file sits under different path. eg: in server 1 it sits under /opt/jboss4/ in server 2 it sits under /opt/jboss5/ in server 3 it sits under /opt/jboss6/ in server 4 no jboss is running now i have 3 different configuration file for each version of jboss which i need to replace. eg. file1, i need to replace it to jboss4 file2 , i need to replace it to jboss5 file3 , i need to replace it to jboss6 also we need to keep in mind that it should not create a files/folder on server4 which doesnt have jboss. Now i need a module which checks the jboss path on each server and should replace the sepcific file if it finds the specific path. eg if it finds /opt/jboss4, then it should replace file1, if it finds /opt/jboss5, then replace file2 and so on. But if no jboss path is found then dont perform any thing on that server. As suggested by Gary ( initial conversation) , gary helped me to create the custom facts. but it didnt work. Not sure what went wrong. in general, my requirement is very simple. just do a check on each server for specific path. if found, then copy/replace respective file , if not found then dont perform any action on that server. I hope i didnt confuse anyone. Thanks, Jeeva On Mon, Apr 16, 2012 at 5:54 AM, Munna S 19.mu...@gmail.com wrote: Hi Sans i am trying it now. will let you know the output soon. Also in my site.pp i have the below content import 'nodes/*' $puppetserver = 'puppet-server.domain.com' I do have many modules , which works as expected. Thanks, Jeeva cat /etc/puppet/manifests/site.pp On Mon, Apr 16, 2012 at 5:36 AM, Sans r.santanu@gmail.com wrote: It's definitely a class loading problem and I don't think Jeeva is using modules at all. Jeeva: Could you pls try the things I said in my previous post and see if that works? Cheers!! On Monday, April 16, 2012 1:34:31 AM UTC+1, Wil Cooley wrote: On Apr 13, 10:49 am, Munna S 19.mu...@gmail.com wrote: I followed your steps. now i am getting below error Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: Could not find class dev_jboss_jeeva for vm-jeeva2.aircell.prod at ... i have jeeva_base.pp file under /etc/puppet/manifests/nodes and below is its content --**-- node jeeva_base { include dev_jboss_jeeva} --** also i have a another .pp file by name vm-jeeva2 under /etc/puppet/manifests/nodes and below is its content. we have seperate .pp file for each server name. one server is vm-jeeva2. -- node vm-jeeva2 inherits jeeva_base {}
Re: [Puppet Users] Re: Need puppet module for condition copy
humm.. not sure but looks like couple of steps from my previous post are missing. Can you pls confirm that you have all of these: 1. The line: *import 'modules'* in */etc/puppet/manifests/site.pp* 2. The line: *import 'jb_test'* in* /etc/puppet/manifests/modules.pp* 3. The file:* /etc/puppet/modules/jb_test/manifests/jb_config.pp* 4. The file:* /etc/puppet/modules/jb_test/manifests/init_config.pp* 5. The file:* /etc/puppet/modules/jb_test/files/group_test* 6. and finally, in the */etc/puppet/manifests/nodes.pp* node 'vm-jeeva2' { include cp_jboss_conf } (don't add inherits jeeva_base for the time being) Cheers!! On Monday, April 16, 2012 1:06:59 PM UTC+1, Jeeva wrote: Hi Sans, I followed your steps, but i am getting the same error again Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/Puppet) Using cached catalog Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog; skipping run @All, Just not to confuse anyone, currently my puppet server is working as expected. i have lot of modules created and it works. This is how my configuration is 1 ) my site.pp file is under /etc/puppet/manifest/site.pp and below is my content import 'nodes/*' $puppetserver = 'puppet-server.domain.com' 2) All my modules is under below path /etc/puppet/modules/ 3) under below path i have all my .pp files . eg /etc/puppet/manifests/nodes/server1.pp /etc/puppet/manifests/nodes/server2.pp /etc/puppet/manifests/nodes/server3.pp /etc/puppet/manifests/nodes/server4.pp addition to this i have a jeeva_base.pp file where i include all my modules. below is the portion of its content --- node jeeva_base { include all_scripts include dev_jboss_jeeva } --- below is the content of my server1.pp file . i have created individual .pp file for each server which inherits jeeva_base node. -- node server1 inherits jeeva_base { } --- As i said above, this is my requirement. we have 3 version of jboss running in our environment in different servers. eg. jboss4 in server1, jboss5 in server2 , jboss6 in server3 , and no jboss in server 4 , etc on each server, jboss config file sits under different path. eg: in server 1 it sits under /opt/jboss4/ in server 2 it sits under /opt/jboss5/ in server 3 it sits under /opt/jboss6/ in server 4 no jboss is running now i have 3 different configuration file for each version of jboss which i need to replace. eg. file1, i need to replace it to jboss4 file2 , i need to replace it to jboss5 file3 , i need to replace it to jboss6 also we need to keep in mind that it should not create a files/folder on server4 which doesnt have jboss. Now i need a module which checks the jboss path on each server and should replace the sepcific file if it finds the specific path. eg if it finds /opt/jboss4, then it should replace file1, if it finds /opt/jboss5, then replace file2 and so on. But if no jboss path is found then dont perform any thing on that server. As suggested by Gary ( initial conversation) , gary helped me to create the custom facts. but it didnt work. Not sure what went wrong. in general, my requirement is very simple. just do a check on each server for specific path. if found, then copy/replace respective file , if not found then dont perform any action on that server. I hope i didnt confuse anyone. Thanks, Jeeva On Mon, Apr 16, 2012 at 5:54 AM, Munna S 19.mu...@gmail.com wrote: Hi Sans i am trying it now. will let you know the output soon. Also in my site.pp i have the below content import 'nodes/*' $puppetserver = 'puppet-server.domain.com' I do have many modules , which works as expected. Thanks, Jeeva cat /etc/puppet/manifests/site.pp On Mon, Apr 16, 2012 at 5:36 AM, Sans r.santanu@gmail.com wrote: It's definitely a class loading problem and I don't think Jeeva is using modules at all. Jeeva: Could you pls try the things I
Re: [Puppet Users] Re: Need puppet module for condition copy
1. The line: *import 'modules'* in */etc/puppet/manifests/site.pp - i do have site.pp file but dont have the entry for modules. i added the entry but later i saw lot of errors related to modules in log * 2. The line: *import 'jb_test'* in* /etc/puppet/manifests/modules.pp - i dont have modules.pp file. But as i said in my previous email, i have customised servername.pp siles * 3. The file:* /etc/puppet/modules/jb_test/manifests/jb_config.pp - i created this file * 4. The file:* /etc/puppet/modules/jb_test/manifests/init_config.pp - i created this file * 5. The file:* /etc/puppet/modules/jb_test/files/group_test - i have this file* 6. and finally, in the */etc/puppet/manifests/nodes.pp - I dont have this file in my configuration* On Mon, Apr 16, 2012 at 7:38 AM, Sans r.santanu@gmail.com wrote: humm.. not sure but looks like couple of steps from my previous post are missing. Can you pls confirm that you have all of these: 1. The line: *import 'modules'* in */etc/puppet/manifests/site.pp* 2. The line: *import 'jb_test'* in* /etc/puppet/manifests/modules.pp* 3. The file:* /etc/puppet/modules/jb_test/manifests/jb_config.pp* 4. The file:* /etc/puppet/modules/jb_test/manifests/init_config.pp* 5. The file:* /etc/puppet/modules/jb_test/files/group_test* 6. and finally, in the */etc/puppet/manifests/nodes.pp* node 'vm-jeeva2' { include cp_jboss_conf } (don't add inherits jeeva_base for the time being) Cheers!! On Monday, April 16, 2012 1:06:59 PM UTC+1, Jeeva wrote: Hi Sans, I followed your steps, but i am getting the same error again Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/* *vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/* *vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/**Puppet) Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/**vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/**Puppet) Using cached catalog Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/**Puppet) Could not retrieve catalog; skipping run @All, Just not to confuse anyone, currently my puppet server is working as expected. i have lot of modules created and it works. This is how my configuration is 1 ) my site.pp file is under /etc/puppet/manifest/site.pp and below is my content import 'nodes/*' $puppetserver = 'puppet-server.domain.com' 2) All my modules is under below path /etc/puppet/modules/ 3) under below path i have all my .pp files . eg /etc/puppet/manifests/nodes/**server1.pp /etc/puppet/manifests/nodes/**server2.pp /etc/puppet/manifests/nodes/**server3.pp /etc/puppet/manifests/nodes/**server4.pp addition to this i have a jeeva_base.pp file where i include all my modules. below is the portion of its content --**- node jeeva_base { include all_scripts include dev_jboss_jeeva } --**- below is the content of my server1.pp file . i have created individual .pp file for each server which inherits jeeva_base node. --** node server1 inherits jeeva_base { } --**- As i said above, this is my requirement. we have 3 version of jboss running in our environment in different servers. eg. jboss4 in server1, jboss5 in server2 , jboss6 in server3 , and no jboss in server 4 , etc on each server, jboss config file sits under different path. eg: in server 1 it sits under /opt/jboss4/ in server 2 it sits under /opt/jboss5/ in server 3 it sits under /opt/jboss6/ in server 4 no jboss is running now i have 3 different configuration file for each version of jboss which i need to replace. eg. file1, i need to replace it to jboss4 file2 , i need to replace it to jboss5 file3 , i need to replace it to jboss6 also we need to keep in mind that it should not create a files/folder on server4 which doesnt have jboss. Now i need a module which checks the jboss path on each server and should replace the sepcific file if it finds the specific path. eg if it finds /opt/jboss4, then it should replace file1, if it finds /opt/jboss5, then replace file2 and so on. But if no jboss path is found then dont perform any thing on that server. As suggested by Gary ( initial conversation) , gary helped me to create the custom facts. but
Re: [Puppet Users] Re: Need puppet module for condition copy
According to your configuration, I don't think my code will work at all. Your setup is quite different then mine and I've no other suggestions for you at the moment. Hopefully, someone else will pick it up from here. Cheers!! On Monday, April 16, 2012 1:59:25 PM UTC+1, Jeeva wrote: 1. The line: *import 'modules'* in */etc/puppet/manifests/site.pp - i do have site.pp file but dont have the entry for modules. i added the entry but later i saw lot of errors related to modules in log * 2. The line: *import 'jb_test'* in* /etc/puppet/manifests/modules.pp - i dont have modules.pp file. But as i said in my previous email, i have customised servername.pp siles * 3. The file:* /etc/puppet/modules/jb_test/manifests/jb_config.pp - i created this file * 4. The file:* /etc/puppet/modules/jb_test/manifests/init_config.pp - i created this file * 5. The file:* /etc/puppet/modules/jb_test/files/group_test - i have this file* 6. and finally, in the */etc/puppet/manifests/nodes.pp - I dont have this file in my configuration* On Mon, Apr 16, 2012 at 7:38 AM, Sans r.santanu@gmail.com wrote: humm.. not sure but looks like couple of steps from my previous post are missing. Can you pls confirm that you have all of these: 1. The line: *import 'modules'* in */etc/puppet/manifests/site.pp* 2. The line: *import 'jb_test'* in* /etc/puppet/manifests/modules.pp* 3. The file:* /etc/puppet/modules/jb_test/manifests/jb_config.pp* 4. The file:* /etc/puppet/modules/jb_test/manifests/init_config.pp* 5. The file:* /etc/puppet/modules/jb_test/files/group_test* 6. and finally, in the */etc/puppet/manifests/nodes.pp* node 'vm-jeeva2' { include cp_jboss_conf } (don't add inherits jeeva_base for the time being) Cheers!! On Monday, April 16, 2012 1:06:59 PM UTC+1, Jeeva wrote: Hi Sans, I followed your steps, but i am getting the same error again Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/ **vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/ **vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/**Puppet) Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/**vm-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/**Puppet) Using cached catalog Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/**Puppet) Could not retrieve catalog; skipping run @All, Just not to confuse anyone, currently my puppet server is working as expected. i have lot of modules created and it works. This is how my configuration is 1 ) my site.pp file is under /etc/puppet/manifest/site.pp and below is my content import 'nodes/*' $puppetserver = 'puppet-server.domain.com' 2) All my modules is under below path /etc/puppet/modules/ 3) under below path i have all my .pp files . eg /etc/puppet/manifests/nodes/**server1.pp /etc/puppet/manifests/nodes/**server2.pp /etc/puppet/manifests/nodes/**server3.pp /etc/puppet/manifests/nodes/**server4.pp addition to this i have a jeeva_base.pp file where i include all my modules. below is the portion of its content --**- node jeeva_base { include all_scripts include dev_jboss_jeeva } --**- below is the content of my server1.pp file . i have created individual .pp file for each server which inherits jeeva_base node. --** node server1 inherits jeeva_base { } --**- As i said above, this is my requirement. we have 3 version of jboss running in our environment in different servers. eg. jboss4 in server1, jboss5 in server2 , jboss6 in server3 , and no jboss in server 4 , etc on each server, jboss config file sits under different path. eg: in server 1 it sits under /opt/jboss4/ in server 2 it sits under /opt/jboss5/ in server 3 it sits under /opt/jboss6/ in server 4 no jboss is running now i have 3 different configuration file for each version of jboss which i need to replace. eg. file1, i need to replace it to jboss4 file2 , i need to replace it to jboss5 file3 , i need to replace it to jboss6 also we need to keep in mind that it should not create a files/folder on server4 which doesnt have jboss. Now i need a module which checks the jboss path on each server and
Re: [Puppet Users] Re: Need puppet module for condition copy
Thank you so much San for your time and help. Can anyone help me with this -Jeeva On Mon, Apr 16, 2012 at 9:54 AM, Sans r.santanu@gmail.com wrote: According to your configuration, I don't think my code will work at all. Your setup is quite different then mine and I've no other suggestions for you at the moment. Hopefully, someone else will pick it up from here. Cheers!! On Monday, April 16, 2012 1:59:25 PM UTC+1, Jeeva wrote: 1. The line: *import 'modules'* in */etc/puppet/manifests/site.pp - i do have site.pp file but dont have the entry for modules. i added the entry but later i saw lot of errors related to modules in log * 2. The line: *import 'jb_test'* in* /etc/puppet/manifests/modules.pp - i dont have modules.pp file. But as i said in my previous email, i have customised servername.pp siles * 3. The file:* /etc/puppet/modules/jb_test/manifests/jb_config.pp - i created this file * 4. The file:* /etc/puppet/modules/jb_test/manifests/init_config.pp - i created this file * 5. The file:* /etc/puppet/modules/jb_test/files/group_test - i have this file* 6. and finally, in the */etc/puppet/manifests/nodes.pp - I dont have this file in my configuration* On Mon, Apr 16, 2012 at 7:38 AM, Sans r.santanu@gmail.com wrote: humm.. not sure but looks like couple of steps from my previous post are missing. Can you pls confirm that you have all of these: 1. The line: *import 'modules'* in */etc/puppet/manifests/site.pp* 2. The line: *import 'jb_test'* in* /etc/puppet/manifests/modules.pp* 3. The file:* /etc/puppet/modules/jb_test/manifests/jb_config.pp* 4. The file:* /etc/puppet/modules/jb_test/manifests/init_config.pp* 5. The file:* /etc/puppet/modules/jb_test/files/group_test* 6. and finally, in the */etc/puppet/manifests/nodes.pp* node 'vm-jeeva2' { include cp_jboss_conf } (don't add inherits jeeva_base for the time being) Cheers!! On Monday, April 16, 2012 1:06:59 PM UTC+1, Jeeva wrote: Hi Sans, I followed your steps, but i am getting the same error again Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/ **vm**-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/ **vm**-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/**Pupp**et) Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class cp_jboss_conf for vm-jeeva2.aircell.prod at /etc/puppet/manifests/nodes/**vm**-jeeva2.aircell.prod.pp:2 on node vm-jeeva2.aircell.prod Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/**Pupp**et) Using cached catalog Apr 16 11:29:39 pil-vm-pup-01 puppet-master[8092]: (//vm-jeeva2.aircell.prod/**Pupp**et) Could not retrieve catalog; skipping run @All, Just not to confuse anyone, currently my puppet server is working as expected. i have lot of modules created and it works. This is how my configuration is 1 ) my site.pp file is under /etc/puppet/manifest/site.pp and below is my content import 'nodes/*' $puppetserver = 'puppet-server.domain.com' 2) All my modules is under below path /etc/puppet/modules/ 3) under below path i have all my .pp files . eg /etc/puppet/manifests/nodes/**se**rver1.pp /etc/puppet/manifests/nodes/**se**rver2.pp /etc/puppet/manifests/nodes/**se**rver3.pp /etc/puppet/manifests/nodes/**se**rver4.pp addition to this i have a jeeva_base.pp file where i include all my modules. below is the portion of its content --- node jeeva_base { include all_scripts include dev_jboss_jeeva } --- below is the content of my server1.pp file . i have created individual .pp file for each server which inherits jeeva_base node. -- node server1 inherits jeeva_base { } --- As i said above, this is my requirement. we have 3 version of jboss running in our environment in different servers. eg. jboss4 in server1, jboss5 in server2 , jboss6 in server3 , and no jboss in server 4 , etc on each server, jboss config file sits under different path. eg: in server 1 it sits under /opt/jboss4/ in server 2 it sits under /opt/jboss5/ in server 3 it sits under /opt/jboss6/ in server 4 no jboss is running now i have 3 different configuration file for each version of jboss which i need to replace. eg. file1, i need to replace it to jboss4 file2 , i need to replace it to jboss5 file3 , i need to replace it to jboss6 also we need to keep in mind that
[Puppet Users] Re: Need puppet module for condition copy
On Apr 13, 10:49 am, Munna S 19.mu...@gmail.com wrote: I followed your steps. now i am getting below error Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: Could not find class dev_jboss_jeeva for vm-jeeva2.aircell.prod at ... i have jeeva_base.pp file under /etc/puppet/manifests/nodes and below is its content node jeeva_base { include dev_jboss_jeeva} -- also i have a another .pp file by name vm-jeeva2 under /etc/puppet/manifests/nodes and below is its content. we have seperate .pp file for each server name. one server is vm-jeeva2. -- node vm-jeeva2 inherits jeeva_base {} what could be the problem ? Where is the class dev_jboss_jeeva defined? You mentioned above an 'init.pp', which would be usual if you were using modules, but it does not seem like you are using modules. It sounds like the problem you are having is wholly outside of the complicated machinations of what you're trying to do. It looks more like you have a much simpler class-loading problem. Here are a few things to try: * Comment out all of the stuff from dev_jboss_jeeva and replace it with a warning function call, to log that everything is working right: class dev_jboss_jeeva { warning(dev_jboss_jeeva has successfully loaded) } * Copy your class dev_jboss_jeeva { ... } right before the node jeeva_base and see if you see your warning message (I suggest warning instead of info because info sometimes requires using --verbose on the command line; warning will always show): class dev_jboss_jeeva { warning(dev_jboss_jeeva was here) } node jeeva_base { include dev_jboss_jeeva } If you see the message with the class defined right before the node, but not wherever else you have it, then you know the problem is that it is unable to actually find the class and you should give specifics about that instead. Wil -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
I don't have *node-based* setup; all my configuration is *module-based*, so cannot comment on that but I assume it should have worked in the same way. To make it plain and simple, could you please follow the steps below and see if it works? *On the puppet master: * - #* mkdir -p /etc/puppet/modules/jb_test/{manifests,files}* - Add: *import 'modules'* to /etc/puppet/manifests/site.pp - #* echo import 'jb_test' /etc/puppet/manifests/modules.pp* - #* cp /etc/group /etc/puppet/modules/jb_test/files/group.pp* - Create this jb_config.pp: * /etc/puppet/modules/dev_jboss_jeeva/manifests/jb_config.pp* # /etc/puppet/modules/dev_jboss_jeeva/manifests/jb_config.pp class jb_test::jb_config { $j_conf = 'group.pp' define jb_dir($dir) { $jj_conf = $jb_test::jb_config::j_conf exec { lnk_${dir}: path= [ '/bin', '/usr/bin' ], #command = cp /tmp/${jj_conf} /opt/${path}/ rm /tmp/${jj_conf}, command = ln -s /opt/jconf/${jj_conf} /opt/${dir}/, onlyif = test -d /opt/${dir}, } } } - Create init.pp:* * * /etc/puppet/modules/dev_jboss_jeeva/manifests/init.pp* # /etc/puppet/modules/jb_test/manifests/init.pp class cp_jboss_conf { include jb_test::jb_config $cp_file= $jb_test::jb_config::j_conf $conf_dir = '/opt/j_config' #notify { The file name is: ${cp_file}: } # create main config directory exec { 'mkdir_jconf': path = [ '/bin', '/usr/bin' ], command = mkdir -p ${conf_dir}, unless = test -d ${conf_dir}, } file { ${cp_file}: name= ${conf_dir}/${cp_file}, mode = '0644', owner = 'root', group = 'root', source = puppet:///modules/jb_test/${cp_file}, require = Exec[ 'mkdir_jconf' ]; } jb_test::jb_config::jb_dir { 'copy_to_1st': dir = 'jboss_1'; 'copy_to_2nd': dir = 'jboss_2'; 'copy_to_3rd': dir = 'jboss_3'; } } - Add this to: */etc/puppet/manifests/nodes.pp* node vm-jeeva2 inherits jeeva_base { include cp_jboss_conf } *On the puppet agent:* - #* mkdir -p /opt/jboss_{1,3}* - #* puppetd --test * If everything goes right, then you will see these things on the client machine: 1. */opt/j_config* is created, if already not there 2. *group.pp* is copied to */opt/j_config* 3. A symbolic link is created on the /opt/jboss_{1|3}: *group.pp - /opt/j_config/group.pp* Hope, that will solve your problem. cheers!! On Friday, April 13, 2012 6:49:47 PM UTC+1, Jeeva wrote: I followed your steps. now i am getting below error Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: 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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: 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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//vm-jeeva2.aircell.prod/Puppet) Using cached catalog Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog; skipping run Apr 13 17:43:44 pil-vm-pup-01 puppet-master[7899]: 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 i have jeeva_base.pp file under /etc/puppet/manifests/nodes and below is its content node jeeva_base { include dev_jboss_jeeva } -- also i have a another .pp file by name vm-jeeva2 under /etc/puppet/manifests/nodes and below is its content. we have seperate .pp file for each server name. one server is vm-jeeva2. -- node vm-jeeva2 inherits jeeva_base { } what could be the problem ? On Thu, Apr 12, 2012 at 2:47 PM, Sans r.santanu@gmail.com wrote: You probably getting: file not found or something like that? It's because you are trying to copy a file from one machine (i.e. puppet server) to another machine, your puppet agent, using cp command. Puppet has file{} resource and source parameter for that. Other than that, if not typo, I don't see any gap between the source_path and the dest_path in your cp command. Also, I think class d_services::jboss is wrong in your case. You don't have any d_services module, I suppose. Try this: If jmx-
Re: [Puppet Users] Re: Need puppet module for condition copy
(I don't have *node-based* setup (all my configuration is module-based) so can't comment on that but I assume it should have worked that same way. To make it plain a and simple, could you follow the steps below and see if it works? *On the puppet-master:* - # *mkdir -p /etc/puppet/modules/jb_test/{manifests,files}* - #* echo import 'jb_test' /etc/puppet/manifests/modules.pp* - Add: *import 'modules'* to */etc/puppet/manifests/site.pp* - #* cp /etc/group /etc/puppet/modules/jb_test/files/group_test* - Create *jb_config.pp:**/etc/puppet/modules/jb_test/manifests/jb_config.pp * # /etc/puppet/modules/jb_test/manifests/jb_config.pp class jb_test::jb_config { $j_conf = 'group_test' define jb_dir($dir) { $jj_conf = $jb_test::jb_config::j_conf exec { lnk_${dir}: path= [ '/bin', '/usr/bin' ], command = ln -s /opt/j_config/${jj_conf} /opt/${dir}/, onlyif = test -d /opt/${dir}, } } } * * - Create* init.pp:* */etc/puppet/modules/jb_test/manifests/init.pp* # /etc/puppet/modules/jb_test/manifests/init.pp class cp_jboss_conf { include jb_test::jb_config $cp_file = $jb_test::jb_config::j_conf $conf_dir = '/opt/j_config' #notify { The file name is: ${cp_file}: } # create directory recursively exec { 'mkdir_jconf': path= [ '/bin', '/usr/bin' ], command = mkdir -p ${conf_dir}, unless = test -d ${conf_dir}, } file { ${cp_file}: name= ${conf_dir}/${cp_file}, mode = '0644', owner = 'root', group = 'root', source = puppet:///modules/jb_test/${cp_file}, require = Exec[ 'mkdir_jconf' ]; } jb_test::jb_config::jb_dir { 'copy_to_1st': dir = 'jboss_1'; 'copy_to_2nd': dir = 'jboss_2'; 'copy_to_3rd': dir = 'jboss_3'; } } ** - Modify *nodes.pp: **/etc/puppet/manifests/nodes.pp** * node 'vm-jeeva2' inherits jeeva_base { include cp_jboss_conf } *On the puppet-agent: * - # *mkdir -p /opt/jboss_{1,3}* - # *puppetd --test** * If every thing goes right (and I didn't miss anything down the line), you see these things on the agent(s): 1. */opt/j_config* is created (if already not there) 2. The file:* group_test* is copied in the */opt/j_config* 3. A symbolic-link: *group_test - /opt/j_config/group_test* is created in each */opt/jboss_{1,3}* * *I think, that's what you basically asked for. The only difference is the symbolic-link (as opposed to the copy) in this setup. In stead of the sysm-link, you can first copy the file to the */root* (or somewhere secure, if */tmp* is a security issue for the configuration file) and then copy the file from */root* to */opt/jboss_{1,2,3}*, whichever is available. Does it work for you? cheers!! On Friday, April 13, 2012 6:49:47 PM UTC+1, Jeeva wrote: I followed your steps. now i am getting below error Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: 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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: 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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//vm-jeeva2.aircell.prod/Puppet) Using cached catalog Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog; skipping run Apr 13 17:43:44 pil-vm-pup-01 puppet-master[7899]: 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 i have jeeva_base.pp file under /etc/puppet/manifests/nodes and below is its content node jeeva_base { include dev_jboss_jeeva } -- also i have a another .pp file by name vm-jeeva2 under /etc/puppet/manifests/nodes and below is its content. we have seperate .pp file for each server name. one server is vm-jeeva2. -- node vm-jeeva2 inherits jeeva_base { } what could be the problem ? On Thu, Apr 12, 2012 at 2:47 PM, Sans r.santanu@gmail.com wrote: You probably getting: file not found or something like that? It's because you are trying to copy a file from one machine (i.e. puppet server) to another machine, your puppet agent, using cp command.
Re: [Puppet Users] Re: Need puppet module for condition copy
I don't have *node-based* setup (all my configuration is module-based) so can't comment on that but I assume it should have worked that same way. To make it plain a and simple, could you follow the steps below and see if it works? *On the puppet-master:* - # *mkdir -p /etc/puppet/modules/jb_test/{manifests,files}* - #* echo import 'jb_test' /etc/puppet/manifests/modules.pp* - Add: *import 'modules'* to */etc/puppet/manifests/site.pp* - #* cp /etc/group /etc/puppet/modules/jb_test/files/group_test* - Create *jb_config.pp:**/etc/puppet/modules/jb_test/manifests/jb_config.pp * # /etc/puppet/modules/jb_test/manifests/jb_config.pp class jb_test::jb_config { $j_conf = 'group_test' define jb_dir($dir) { $jj_conf = $jb_test::jb_config::j_conf exec { lnk_${dir}: path= [ '/bin', '/usr/bin' ], command = ln -s /opt/j_config/${jj_conf} /opt/${dir}/, onlyif = test -d /opt/${dir}, } } } * * - Create* init.pp:* */etc/puppet/modules/jb_test/manifests/init.pp* # /etc/puppet/modules/jb_test/manifests/init.pp class cp_jboss_conf { include jb_test::jb_config $cp_file = $jb_test::jb_config::j_conf $conf_dir = '/opt/j_config' #notify { The file name is: ${cp_file}: } # create directory recursively exec { 'mkdir_jconf': path= [ '/bin', '/usr/bin' ], command = mkdir -p ${conf_dir}, unless = test -d ${conf_dir}, } file { ${cp_file}: name= ${conf_dir}/${cp_file}, mode = '0644', owner = 'root', group = 'root', source = puppet:///modules/jb_test/${cp_file}, require = Exec[ 'mkdir_jconf' ]; } jb_test::jb_config::jb_dir { 'copy_to_1st': dir = 'jboss_1'; 'copy_to_2nd': dir = 'jboss_2'; 'copy_to_3rd': dir = 'jboss_3'; } } - Modify *nodes.pp: **/etc/puppet/manifests/nodes.pp** * node 'vm-jeeva2' inherits jeeva_base { include cp_jboss_conf } *On the puppet-agent: * - # *mkdir -p /opt/jboss_{1,3}* - # *puppetd --test** * If every thing goes right (and I didn't miss anything down the line), you see these things on the agent(s): 1. */opt/j_config* is created (if already not there) 2. The file:* group_test* is copied in the */opt/j_config* 3. A symbolic-link: *group_test - /opt/j_config/group_test* is created in each */opt/jboss_{1,3}* * *I think, that's what you basically asked for. The only difference is the symbolic-link (as opposed to the copy) in this setup. In stead of the sysm-link, you can first copy the file to the */root* (or somewhere secure, if */tmp* is a security issue for the configuration file) and then copy the file from */root* to */opt/jboss_{1,2,3}*, whichever is available. Does it work for you? cheers!! On Friday, April 13, 2012 6:49:47 PM UTC+1, Jeeva wrote: I followed your steps. now i am getting below error Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: 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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: 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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//vm-jeeva2.aircell.prod/Puppet) Using cached catalog Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog; skipping run Apr 13 17:43:44 pil-vm-pup-01 puppet-master[7899]: 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 i have jeeva_base.pp file under /etc/puppet/manifests/nodes and below is its content node jeeva_base { include dev_jboss_jeeva } -- also i have a another .pp file by name vm-jeeva2 under /etc/puppet/manifests/nodes and below is its content. we have seperate .pp file for each server name. one server is vm-jeeva2. -- node vm-jeeva2 inherits jeeva_base { } what could be the problem ? On Thu, Apr 12, 2012 at 2:47 PM, Sans r.santanu@gmail.com wrote: You probably getting: file not found or something like that? It's because you are trying to copy a file from one machine (i.e. puppet server) to another machine, your puppet agent, using cp command. Puppet
Re: [Puppet Users] Re: Need puppet module for condition copy
I followed your steps. now i am getting below error Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: 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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: 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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//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 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//vm-jeeva2.aircell.prod/Puppet) Using cached catalog Apr 13 17:42:44 pil-vm-pup-01 puppet-master[7899]: (//vm-jeeva2.aircell.prod/Puppet) Could not retrieve catalog; skipping run Apr 13 17:43:44 pil-vm-pup-01 puppet-master[7899]: 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 i have jeeva_base.pp file under /etc/puppet/manifests/nodes and below is its content node jeeva_base { include dev_jboss_jeeva } -- also i have a another .pp file by name vm-jeeva2 under /etc/puppet/manifests/nodes and below is its content. we have seperate .pp file for each server name. one server is vm-jeeva2. -- node vm-jeeva2 inherits jeeva_base { } what could be the problem ? On Thu, Apr 12, 2012 at 2:47 PM, Sans r.santanu@gmail.com wrote: You probably getting: file not found or something like that? It's because you are trying to copy a file from one machine (i.e. puppet server) to another machine, your puppet agent, using cp command. Puppet has file{} resource and source parameter for that. Other than that, if not typo, I don't see any gap between the source_path and the dest_path in your cp command. Also, I think class d_services::jboss is wrong in your case. You don't have any d_services module, I suppose. Try this: If jmx- console-users.properties is the file that your are trying to copy, then create a directory on your Puppet-master at etc/puppet/modules/ dev_jboss_jeeva/files and put the configuration file(s) in there first. Then, use this: # /etc/puppet/modules/dev_jboss_jeeva/manifests/jboss.pp class dev_jboss_jeeva::jboss { define opt_dir($path) { $j_conf = 'jmx-console-users.properties' exec { chk_${path}: path = [ '/bin', '/usr/bin' ], command = test -d /opt/${path}, } file { ${path}_${j_conf}: name= /opt/${path}/${j_conf}, mode= '0644', owner = 'root', group = 'root', source = puppet:///modules/dev_jboss_jeeva/${j_conf}, require = Exec[ chk_${path} ]; } } } Now, suppose you are copying the file: jmx-console-users.properties to /opt/jboss_1, /opt/jboss_2 and /opt/jboss_3 on the agent (if available), change the init.pp like this: # /etc/puppet/modules/dev_jboss_jeeva/manifests/init.pp class copy_jboss_conf { include dev_jboss_jeeva::jboss dev_jboss_jeeva::jboss::opt_dir { 'copy_to_1st': path = 'jboss_1'; 'copy_to_2nd': path = 'jboss_2'; 'copy_to_3rd': path = 'jboss_3'; } } ** Not tested, but should work. At least it's working for me in similar fashion. Cheers!! On Apr 12, 6:40 pm, Munna S 19.mu...@gmail.com wrote: Hi Sans, This is my jboss.pp file class d_services::jboss { define opt_dir($path) { exec { copy_${path}: path= [ '/bin', '/usr/bin' ], command = cp /etc/puppet/modules/dev_jboss_jeeva/opt/jboss/ jboss-4.2.3.GA/server/default/conf/props/jmx-console-users.properties/opt/${path} , onlyif = test -d /opt/${path}, } } } this is my init.pp file class dev_jboss_jeeva { include d_services::jboss d_services::jboss::opt_dir { 'jboss_1': path = '/opt/jboss/jboss-4.2.3.GA/server/default/conf/props/'; } } But i am still getting the error -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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.
Re: [Puppet Users] Re: Need puppet module for condition copy
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 19.mu...@gmail.com wrote: Thank you so much Gary. I will try this Thanks, Jeeva On Sun, Apr 1, 2012 at 11:05 PM, Gary Larizza g...@puppetlabs.com 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 19.mu...@gmail.com 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 g...@puppetlabs.comwrote: 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 19.mu...@gmail.com wrote: Team, Any help Thanks, Jeeva On Fri, Mar 30, 2012 at 12:51 PM, Munna S 19.mu...@gmail.com 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
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 19.mu...@gmail.com 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 19.mu...@gmail.com wrote: Thank you so much Gary. I will try this Thanks, Jeeva On Sun, Apr 1, 2012 at 11:05 PM, Gary Larizza g...@puppetlabs.comwrote: 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 19.mu...@gmail.com 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 g...@puppetlabs.comwrote: 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 19.mu...@gmail.com wrote: Team, Any help Thanks, Jeeva On Fri, Mar 30, 2012 at 12:51 PM, Munna S 19.mu...@gmail.com 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send
Re: [Puppet Users] Re: Need puppet module for condition copy
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 g...@gallew.org 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 19.mu...@gmail.com 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 19.mu...@gmail.com wrote: Thank you so much Gary. I will try this Thanks, Jeeva On Sun, Apr 1, 2012 at 11:05 PM, Gary Larizza g...@puppetlabs.comwrote: 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 19.mu...@gmail.com 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 g...@puppetlabs.comwrote: 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 19.mu...@gmail.com wrote: Team, Any help Thanks, Jeeva On Fri, Mar 30, 2012 at 12:51 PM, Munna S 19.mu...@gmail.comwrote: 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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
[Puppet Users] Re: Need puppet module for condition copy
As Brian suggested, using define{} is the better way of doing it; you can even copy different files to different directories, if required. Something like this: # /etc/puppet/modules/ur_module/manifests/staging.pp -- class ur_module::staging { define opt_dir($file, $path) { exec { copy_${dir}: path= [ '/bin', '/usr/bin' ], command = rsync -a /var/staging/${file} /opt/${path}, onlyif = test -d /opt/${path}, } } --- and, then in the init.pp: # /etc/puppet/modules/ur_module/manifests/init.pp --- class file_copy { include ur_module::staging ur_module::staging::opt_dir { 'path_1': file = 'file.txt', path = 'path1'; 'path_2': file = 'another_file.txt', path = 'path2'; . ... keep carrying on ... } } --- That should do that job. Cheers!! On Apr 12, 3:24 pm, Brian Gallew g...@gallew.org 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{} -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
You can't put a file{} resource inside an exec{} resource. On Thu, Apr 12, 2012 at 7:53 AM, Munna S 19.mu...@gmail.com wrote: 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 g...@gallew.org 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 19.mu...@gmail.com 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 19.mu...@gmail.com wrote: Thank you so much Gary. I will try this Thanks, Jeeva On Sun, Apr 1, 2012 at 11:05 PM, Gary Larizza g...@puppetlabs.comwrote: 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 19.mu...@gmail.com 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 g...@puppetlabs.comwrote: 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 19.mu...@gmail.com wrote: Team, Any help Thanks, Jeeva On Fri, Mar 30, 2012 at 12:51 PM, Munna S 19.mu...@gmail.comwrote: 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com.
[Puppet Users] Re: Need puppet module for condition copy
w.r.t ${file}, what I meant is you can make it super dynamic with filenames, if you had to copy different files, as opposed to a single file. This is a perfectly working example (change the values/ parameter as required): # /etc/puppet/modules/ur_module/manifests/test.pp -- class d_services::test { define opt_dir($path) { exec { copy_${path}: path= [ '/bin', '/usr/bin' ], command = cp /tmp/yum.conf.security /opt/${path}, onlyif = test -d /opt/${path}, } } } # /etc/puppet/modules/ur_module/manifests/init.pp --- class mod_test { include d_services::test d_services::test::opt_dir { 'test_1': path = 'test1'; 'test_2': path = 'test2'; 'test_3': path = 'test3'; } } --- It will copy /tmp/yum.conf.security to /opt/test{1|2|3}, if available. Hope this helps. Cheers!! On Apr 12, 4:17 pm, Munna S 19.mu...@gmail.com wrote: I am bit confused about /var/staging/${file} . Let me explain again my requirement. we have 3 version of jboss running on multiple servers. I need a puppet module to copy a jboss config file to different location based on path condition check . Below is my requirement if /opt/path1 found on the server then copy file1 or 2 if /opt/path2 found on the server then copy file1 or 2 if /opt/path3 found on the server then copy file1 or 2 if none of the above path found then dont copy any file -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
Hi Sans, This is my jboss.pp file class d_services::jboss { define opt_dir($path) { exec { copy_${path}: path= [ '/bin', '/usr/bin' ], command = cp /etc/puppet/modules/dev_jboss_jeeva/opt/jboss/ jboss-4.2.3.GA/server/default/conf/props/jmx-console-users.properties/opt/${path}, onlyif = test -d /opt/${path}, } } } this is my init.pp file class dev_jboss_jeeva { include d_services::jboss d_services::jboss::opt_dir { 'jboss_1': path = '/opt/jboss/jboss-4.2.3.GA/server/default/conf/props/'; } } But i am still getting the error On Thu, Apr 12, 2012 at 12:26 PM, Munna S 19.mu...@gmail.com wrote: source file path it will take from my puppet master server right ? -Jeeva On Thu, Apr 12, 2012 at 11:20 AM, Sans r.santanu@gmail.com wrote: w.r.t ${file}, what I meant is you can make it super dynamic with filenames, if you had to copy different files, as opposed to a single file. This is a perfectly working example (change the values/ parameter as required): # /etc/puppet/modules/ur_module/manifests/test.pp -- class d_services::test { define opt_dir($path) { exec { copy_${path}: path= [ '/bin', '/usr/bin' ], command = cp /tmp/yum.conf.security /opt/${path}, onlyif = test -d /opt/${path}, } } } # /etc/puppet/modules/ur_module/manifests/init.pp --- class mod_test { include d_services::test d_services::test::opt_dir { 'test_1': path = 'test1'; 'test_2': path = 'test2'; 'test_3': path = 'test3'; } } --- It will copy /tmp/yum.conf.security to /opt/test{1|2|3}, if available. Hope this helps. Cheers!! On Apr 12, 4:17 pm, Munna S 19.mu...@gmail.com wrote: I am bit confused about /var/staging/${file} . Let me explain again my requirement. we have 3 version of jboss running on multiple servers. I need a puppet module to copy a jboss config file to different location based on path condition check . Below is my requirement if /opt/path1 found on the server then copy file1 or 2 if /opt/path2 found on the server then copy file1 or 2 if /opt/path3 found on the server then copy file1 or 2 if none of the above path found then dont copy any file -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Need puppet module for condition copy
You probably getting: file not found or something like that? It's because you are trying to copy a file from one machine (i.e. puppet server) to another machine, your puppet agent, using cp command. Puppet has file{} resource and source parameter for that. Other than that, if not typo, I don't see any gap between the source_path and the dest_path in your cp command. Also, I think class d_services::jboss is wrong in your case. You don't have any d_services module, I suppose. Try this: If jmx- console-users.properties is the file that your are trying to copy, then create a directory on your Puppet-master at etc/puppet/modules/ dev_jboss_jeeva/files and put the configuration file(s) in there first. Then, use this: # /etc/puppet/modules/dev_jboss_jeeva/manifests/jboss.pp class dev_jboss_jeeva::jboss { define opt_dir($path) { $j_conf = 'jmx-console-users.properties' exec { chk_${path}: path = [ '/bin', '/usr/bin' ], command = test -d /opt/${path}, } file { ${path}_${j_conf}: name= /opt/${path}/${j_conf}, mode= '0644', owner = 'root', group = 'root', source = puppet:///modules/dev_jboss_jeeva/${j_conf}, require = Exec[ chk_${path} ]; } } } Now, suppose you are copying the file: jmx-console-users.properties to /opt/jboss_1, /opt/jboss_2 and /opt/jboss_3 on the agent (if available), change the init.pp like this: # /etc/puppet/modules/dev_jboss_jeeva/manifests/init.pp class copy_jboss_conf { include dev_jboss_jeeva::jboss dev_jboss_jeeva::jboss::opt_dir { 'copy_to_1st': path = 'jboss_1'; 'copy_to_2nd': path = 'jboss_2'; 'copy_to_3rd': path = 'jboss_3'; } } ** Not tested, but should work. At least it's working for me in similar fashion. Cheers!! On Apr 12, 6:40 pm, Munna S 19.mu...@gmail.com wrote: Hi Sans, This is my jboss.pp file class d_services::jboss { define opt_dir($path) { exec { copy_${path}: path = [ '/bin', '/usr/bin' ], command = cp /etc/puppet/modules/dev_jboss_jeeva/opt/jboss/ jboss-4.2.3.GA/server/default/conf/props/jmx-console-users.properties/opt/${path}, onlyif = test -d /opt/${path}, } } } this is my init.pp file class dev_jboss_jeeva { include d_services::jboss d_services::jboss::opt_dir { 'jboss_1': path = '/opt/jboss/jboss-4.2.3.GA/server/default/conf/props/'; } } But i am still getting the error -- You received this message because you are subscribed to the Google Groups Puppet Users group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Re: Need puppet module for condition copy
Team, Any help Thanks, Jeeva On Fri, Mar 30, 2012 at 12:51 PM, Munna S 19.mu...@gmail.com 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
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 19.mu...@gmail.com wrote: Team, Any help Thanks, Jeeva On Fri, Mar 30, 2012 at 12:51 PM, Munna S 19.mu...@gmail.com 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
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 g...@puppetlabs.com 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 19.mu...@gmail.com wrote: Team, Any help Thanks, Jeeva On Fri, Mar 30, 2012 at 12:51 PM, Munna S 19.mu...@gmail.com 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
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 19.mu...@gmail.com 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 g...@puppetlabs.com 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 19.mu...@gmail.com wrote: Team, Any help Thanks, Jeeva On Fri, Mar 30, 2012 at 12:51 PM, Munna S 19.mu...@gmail.com 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: Need puppet module for condition copy
Thank you so much Gary. I will try this Thanks, Jeeva On Sun, Apr 1, 2012 at 11:05 PM, Gary Larizza g...@puppetlabs.com 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 19.mu...@gmail.com 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 g...@puppetlabs.comwrote: 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 19.mu...@gmail.com wrote: Team, Any help Thanks, Jeeva On Fri, Mar 30, 2012 at 12:51 PM, Munna S 19.mu...@gmail.com 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.