Last active
December 23, 2015 16:39
-
-
Save trashhalo/6663800 to your computer and use it in GitHub Desktop.
Puppet custom resource type example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$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"