Created
November 15, 2014 15:40
-
-
Save oko/bbd1554b9d1e80c77b8d to your computer and use it in GitHub Desktop.
Quick and dirty Puppet manifest for Git repository cloning.
This file contains hidden or 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
# Works, but minimally tested. U@YOR. | |
define git::repo($repo, $location, $autoupdate = false) { | |
package { 'git': | |
ensure => installed, | |
} | |
# Clone repository if $location/.git doesn't already exist | |
exec { "clone-$repo": | |
provider => shell, | |
command => "/usr/bin/git clone $repo $location", | |
onlyif => "/usr/bin/test '!' -d $location/.git", | |
} | |
# If enabled, automatically pull down the latest version | |
if $autoupdate { | |
exec { "pull-$repo": | |
provider => shell, | |
command => "cd $location && /usr/bin/git pull", | |
onlyif => "/usr/bin/test -d $location/.git", | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment