Ask Your Question
4

How to use http:// source for file?

asked 2013-10-08 11:30:21 -0500

parkan gravatar image

I'm trying to use a remote HTTP hosted file (vs local puppet:// url) as a source for one of my resources, but this doesn't seem to be supported by puppet.

Ideally, the behavior would be like this:

  • If file does not exist on master, download it
  • If it exists, make a HEAD request the HTTP URL to get Last-Modified/ETag headers and compare to known version (or check filesize, download + diff, etc), download if different
  • Deploy as normal

Specific use case would be to continuously deploy the mongodb MMS agent, which is updated frequently and is always served ... (more)

edit retag flag offensive close merge delete

Comments

I realize it can be a poor practice to blindly push binary updates to live, but the tradeoff for certain non-essential infrastructure seems firmly in favor of automation. Please correct ...(more)

parkan gravatar imageparkan ( 2013-10-08 11:32:19 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2013-10-08 13:49:22 -0500

Stefan gravatar image

You cannot specify a HTTP URL as a file source and even if puppet supported that, it would require all your agents to be able to access the URL (e.g. require internet access).

Your request can be solved by writing a custom function (functions are always executed on your puppet master) and do something like this

file { 'some_file':
  content => download_content('http://example.com/awesome_software.zip')
}

with download_content beeing a custom function that downloads the software to a local caching directory and then reads the content of the file. But personally I would not do that, because an update might ... (more)

edit flag offensive delete link more

Comments

Thanks, custom function seems like the right solution in our case ("build from nov 6th" is sufficient version information)

parkan gravatar imageparkan ( 2013-10-08 14:29:24 -0500 )edit
1

answered 2013-10-09 03:37:52 -0500

There are several puppet modules on puppet-forge and on github. You can find them by searching on puppet forge for wget or download keywords. There are also modules that can download and unpack archives (zip,tar).

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2013-10-08 11:30:21 -0500

Seen: 14,267 times

Last updated: Oct 09 '13