(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 <[email protected]> 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 <[email protected]> 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}<http://jboss-4.2.3.GA/server/default/conf/props/jmx-console-users.properties/opt/$%7Bpath%7D>
>> ",
>> > 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 [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 view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/edh-787g4UUJ.
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.