[Puppet Users] Re: How to use definitions with common resources?

2009-04-16 Thread philipp Hanselmann

Simon J Mudd schrieb:
 philipp.hanselm...@gmail.com (puppet) writes:

   
 Replace this line:
 
  $download_dir  = '/root/tmp'
   
 with:

#NOTE: generate is executed on the puppetmaster.
 $download_dir = generate(/usr/bin/env,bash,'-c',/bin/
 mktemp)

 With this every time your definition get used it will choose an random
 folder in your /tmp.
 

 Thanks. The idea is good, but it doesn't quite work.

 1. The script unfortunately contains account information
user/passwords for the application's initial installation. Hence
/root/tmp is better as only root users can access this directory.

   
1.) With
mktemp -p /root

this will choose a random folder name begining with /root


2. ) permissions?
Your puppet code:

file { $download_dir:
 owner   = root,
 group   = root,
 mode= 700,
 ensure  = directory,
 }

takes already care that only root has access of new generated files in 
the folder $download_dir ?
At least my tests confirmed  that ...


3.) Clean-up of the random folder?

may something like this helps?

exec { $install_script/$software_env:
 command = $download_dir/$install_script ... appropriate 
parameters ...   rm Rf $download_dir,
 onlyif  = ... test if software not installed ...,
 require = File[$download_dir/$install_script]
 }



Philipp

--~--~-~--~~~---~--~~
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: How to use definitions with common resources?

2009-04-16 Thread Simon J Mudd

philipp.hanselm...@gmail.com (philipp Hanselmann) writes:

 Simon J Mudd schrieb:

...

 #NOTE: generate is executed on the puppetmaster.
  $download_dir = generate(/usr/bin/env,bash,'-c',/bin/
  mktemp)
 
  With this every time your definition get used it will choose an random
  folder in your /tmp.
  
 
  Thanks. The idea is good, but it doesn't quite work.
 
  1. The script unfortunately contains account information
 user/passwords for the application's initial installation. Hence
 /root/tmp is better as only root users can access this directory.
 
 1.) With
 mktemp -p /root

Sure. If I'd wanted a random directory I would have done something like that.
The point is that puppet is SLOW at copying files from the master to the client.
Anything that's not a small file takes a while and syncing a directory like
this  (with say 50-100 scripts) gets very tedious. So I'm reluctant to:

copy from master, run, deleteevery 30 minutes on several hundred boxes.
Hence the optimisation of leaving the install script in one place and using
it to decide if any work needs doing. This is just a wrapper around the
vendor provided install binary which is NOT copied with puppet as puppet is
too slow (and the binary is about 20MB).

 3.) Clean-up of the random folder?
 
 may something like this helps?
 
 exec { $install_script/$software_env:
  command = $download_dir/$install_script ... appropriate 
 parameters ...   rm Rf $download_dir,
  onlyif  = ... test if software not installed ...,
  require = File[$download_dir/$install_script]
  }

Not quite. You'd need to have a separate Exec run dependent on the
File[$download_dir/$install_script] as the command shown is not
always run (see onlyif) and thus the rm would not be triggered.

In many ways a post_exec or cleanup =   would be handy which _is_
always run even if command isn't.

And remember part of the problem of this original post was that the
setup of the temporary directory fails if you have 2 similar
installations requiring the same base directory and installation
script. That's what bothers me (and I'd like to solve) more than the
details of the single install problem which works fine for me.

Your suggestions are valid but my implementation is different for the
reasons stated.

Simon

--~--~-~--~~~---~--~~
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: How to use definitions with common resources?

2009-04-15 Thread philipp Hanselmann

Replace this line:
  $download_dir  = '/root/tmp'   
with:

#NOTE: generate is executed on the puppetmaster.
 $download_dir = generate(/usr/bin/env,bash,'-c',/bin/mktemp)


With this every time your definition get used it will choose an random 
folder in your /tmp.


I hope this works?

Philipp

--~--~-~--~~~---~--~~
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: How to use definitions with common resources?

2009-04-15 Thread puppet

Replace this line:
  $download_dir  = '/root/tmp'
with:

   #NOTE: generate is executed on the puppetmaster.
$download_dir = generate(/usr/bin/env,bash,'-c',/bin/
mktemp)


With this every time your definition get used it will choose an random
folder in your /tmp.


I hope this works?

Philipp

--~--~-~--~~~---~--~~
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: How to use definitions with common resources?

2009-04-15 Thread puppet

Replace this line:
  $download_dir  = '/root/tmp'
with:

   #NOTE: generate is executed on the puppetmaster.
$download_dir = generate(/usr/bin/env,bash,'-c',/bin/
mktemp)


With this every time your definition get used it will choose an random
folder in your /tmp.


I hope this works?

Philipp

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---