Ask Your Question

Puppet and subversion

asked 2016-05-20 10:28:26 -0500

adam93 gravatar image

updated 2016-05-21 05:09:45 -0500

I've just started looking at using puppet to align our test environments with production (we can't use puppet to deploy to production unfortunately) as we often have quick bug fixes on production that aren't reflected on test. However our SVN trunk is kept up to date with the latest production code.

I basically need to just replicate files from our svn repository to all agents in certain locations, but looking at the puppet documentation they should be in "module" format and placed in the puppet modules folder (which I can get working manually). Our code isn't structured like that on SVN though and isn't really stored in any standard way (example below).

Can I just setup a cron job to svn checkout to a location on the puppet master and have a folder of manifest files that can be used that just point to the current svn structure rather than the enforced "module" standard?

Example svn, as you can see there isn't really a standard:

trunk -> monitoring_scripts -> scripts -> code here

trunk -> monitoring_scripts -> config -> config here

trunk -> library_files -> code here

trunk -> another_component -> sh -> code here

So I'd want to checkout the svn repo so somewhere on the server and then have manifest files work off that "as is".

Sorry if this is too broad but any advise or general documentation to read around this topic would be greatly appreciated thanks.

Puppet master version : 2.7.26

edit retag flag offensive close merge delete


Are the puppet modules all in one repo or in multiple?

rilindo gravatar imagerilindo ( 2016-05-20 14:44:20 -0500 )edit

There currently aren't any puppet modules. If you referring to the code on subversion it's all in the one repository, but we don't particularly have a standard structure so some components will just be a folder containing scripts others may be split into further config folders etc

adam93 gravatar imageadam93 ( 2016-05-20 16:06:18 -0500 )edit

Yeah I've read this a few times and can't get my head around what you're trying to do. If you can update with more detail and clarity I'll be happy to provide you with some options.

Alex Harvey gravatar imageAlex Harvey ( 2016-05-21 01:18:12 -0500 )edit

Thanks Alex, I've had a go but I'm not sure how much clearer it is.

adam93 gravatar imageadam93 ( 2016-05-21 05:10:18 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2016-05-23 15:06:31 -0500

DarylW gravatar image

updated 2016-05-23 15:07:54 -0500

You can use vcsrepo, and if the paths don't change you can 'source' the files you want to put elsewhere in the location where you've dumped the contents of your repo...

If you are using the value from sahumphries..

vcsrepo { '/localdironhost/vcstest-svn-checkout':
  ensure   => present,
  provider => svn,
  source   => 'http://svn.hostname/branch',

you could use something like this in your manifests

  ensure => directory,
  recurse => true,
  source => '/localdironhost/vcstest-svn-checkout/monit/' 

  ensure => directory,
  recurse => true,
  source => '/localdironhost/vcstest-svn-checkout/library_files/' 
edit flag offensive delete link more

answered 2016-05-22 11:13:01 -0500

If I've understood you then I think you're trying to use Puppet to solve a problem that Puppet's not designed to solve. Actually it sounds like you're trying to make Puppet behave as if it were Rsync, and maybe Rsync will do the job? If you want Puppet to keep these files in sync across nodes then you'll need to move these files into Puppet, and write actual Puppet code to do it. You may also find that what @sahumphries has suggested will work. Good luck.

edit flag offensive delete link more


Writing the puppet code isn't the problem, it's how to use it with my existing teams subversion structure. I'll take a look into Rsync to see if that can achieve the job easier.

adam93 gravatar imageadam93 ( 2016-05-22 14:33:04 -0500 )edit

answered 2016-05-22 05:27:58 -0500

i may be missing the point - but could it be done using the vcsrepo resource - e.g.:

  vcsrepo { '/localdironhost/vcstest-svn-checkout':
  ensure   => present,
  provider => svn,
  source   => 'http://svn.hostname/branch',

this will sync svn repo to all clients..update if I've missed the point here!

Cheers Stuart

edit flag offensive delete link more


Thanks Stuart, I assume this will just reflect the repository "as is" to the environments but unfortunately I need to specify certain files to certain locations.

adam93 gravatar imageadam93 ( 2016-05-22 14:35:27 -0500 )edit

you could use vcsrepo to sync files and then associate an exec to move files where you want them..

sahumphries gravatar imagesahumphries ( 2016-05-23 02:47:24 -0500 )edit

You can use vcsrepo, and if the paths don't change you can 'source' the files you want to put elsewhere in the location where you've dumped the contents of your repo.

DarylW gravatar imageDarylW ( 2016-05-23 15:01:49 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-05-20 10:27:46 -0500

Seen: 383 times

Last updated: May 23 '16