Skip to content

Instantly share code, notes, and snippets.

@trashhalo
Last active December 23, 2015 16:39
Show Gist options
  • Save trashhalo/6663800 to your computer and use it in GitHub Desktop.
Save trashhalo/6663800 to your computer and use it in GitHub Desktop.
Puppet custom resource type example
package{'curl':
ensure => 'present'
}
define remote-package($packagename=$title,$url,$creates){
exec{"download-$packagename":
command=>"/usr/bin/curl -o /tmp/$packagename.deb $url",
creates=>$creates,
require=>Package['curl']
}
package{"$packagename":
ensure=>"present",
require=>Exec["download-$packagename"],
source=>"/tmp/$packagename.deb",
provider=>"dpkg"
}
}
remote-package{'google-chrome-stable':
url=>"https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb",
creates=>'/usr/bin/google-chrome'
}
@trashhalo
Copy link
Author

$packagename=$title is the secret sauce required for it to be the text of the resource name. In this case $title and thus packagename is "google-chrome-stable"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment