Skip to content

Instantly share code, notes, and snippets.

@binford2k
Last active December 21, 2015 20:19
Show Gist options
  • Save binford2k/6360920 to your computer and use it in GitHub Desktop.
Save binford2k/6360920 to your computer and use it in GitHub Desktop.
# This is terrible practice. Instead, you should set up a repo locally and build packages
# to drop in there. RPM and deb files are approaching trivial to make unless you need to
# customize them heavily.
exec { 'build nginx': # just a name
command => "tar -xvzf $file; cd $dir; make; make install", # build & install the package
onlyif => "wget $url", # but only if the download succeeds
creates => '/path/to/installed/nginx', # and only if the installed file doesn't already exist
cwd => '/tmp',
path => '/usr/bin:/bin:...',
}
# alternatively, you could chain multiple resource but that's even more evil.
exec { "wget $url": }
-> exec { "tar -xzf $file": }
-> exec { "make": }
-> exec { "make install": }
############################################################################################
# The right way is just
apt::source { 'myrepo':
location => 'http://my.repo.com',
repos => 'main',
}
package { 'nginx':
ensure => present,
require => Apt::Source['myrepo'],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment