Re: [Puppet Users] How to efficiently manage multiple packages installing in the same directory

Patrick
Tue, 09 Mar 2010 22:09:55 -0000

On Mar 9, 2010, at 11:41 AM, Mathew Binkley wrote:

> Hi everyone.  I am trying to manage several different packages using
> Puppet.  For the sake of maintainability, each package is installed in
> its own separate puppet directory.  Each package would have a separate
> install_package.pp script and corresponding folder in /etc/puppet/
> files on the server:
>
>    /etc/puppet/files/foo/
>                         etc/
>                         root/
>                         usr/local
>
>   /etc/puppet/files/bar/
>                         etc/
>                         var/lib
>
> To avoid micromanaging, I would like to simply copy over the contents
> of each folder to / on the client.  While each package has directories
> in common (/etc for example), all of the files in each package are
> orthogonal and not shared between packages.  For example, package foo
> will be the only package that will ever install /etc/foo.conf.
> Package bar will never manage it.
>

Can''t you split it into stuff that changes and stuff that
doesn''t, and then put the stuff that doesn''t change into a
package.  Then put what ever changes into sub directories?

If that doesn''t work, you could copy and extract a tar file with
something like this:

#Don''t use /tmp because some distro''s nuke that at startup.
#/var/puppet_tmp/ won''t exist.  Make sure you create it.
   file { "/var/puppet_tmp/test.tar.gz":
        owner => "root",
        group => "root",
        mode => 750,
        source => "puppet:///module_name/test.tar.gz",
	require => File["/var/puppet_tmp"]
        }

        exec { "/bin/tar -xvz /var/puppet_tmp/test.tar.gz":
                cwd => "/",
                subscribe => File["/var/puppet_tmp/test.tar.gz"],
		require => File["/var/puppet_tmp/test.tar.gz"]
        }

If you do that a lot, wrapping it in a define shouldn''t be too hard.