Puppet module to clone git repositories.
A simple module to clone git repositoroes. Useful when you need to install software from git rather than apt/yum.
Can also periodically update (git pull) repositories at scheduled intervals.
- Installs git via system package manager.
- Optionally clones and updates git repositories when gitclone::repo type is called.
The module can be included with default values:
include '::gitclone'
gitclone::repo { 'hellogitworld' :
source => 'https://github.com/githubtraining/hellogitworld.git',
destination => '/tmp/hellogitworld',
owner => 'nobody',
group => 'nogroup',
}
The module can be included with default values as in the above example, or explicitly defined to override with custom parameters. The parameters and their defaults are listed below.
Class { '::gitclone' :
package_manage => true,
package_name => 'git',
package_ensure => 'present',
}
package_manage
: Optional. Whether to install git package. Defaults to true. Setting to false will just assume git is installed.package_name
: Optional. Name of git package to install. Defaults to 'git'.package_ensure
: Optional. Ensure value to pass to Puppet's Package type. Value must be one of 'present','installed','latest','held'. Defaults to 'present'.
The gitclone::repo type is used to define the repository to clone/update.
gitclone::repo { 'hellogitworld' :
source => 'https://github.com/githubtraining/hellogitworld.git',
destination => '/tmp/hellogitworld',
owner => 'nobody',
group => 'nogroup',
depth => 'all',
branch => 'master',
update => 'never',
}
source
: Required. URI of git repository to clone.destination
: Required. Local directory to clone repository to.owner
: Required. Username/UID to chown to after git clone/pull.group
: Required. Group/GID to chown to after git clone/pull.depth
: Optional. Only clone last x revistions. Defaults to 'all'.branch
: Optional. Branch to checkout after clone.update
: Optional. Update cloned repo via git pull every never, hourly, daily, weekly, monthly
gitclone
: The main class to include this module.
gitclone::package
: Class to install git package.
gitclone::repo
: Type to clone/update a git repository.
This module has been made for (osfamily) Debian and RedHat (and their derivatives), however it should work fine on any 'nix so long as git is installed or installable.
Appreciate any suggestions on feature or code changes. Let me know if you want to contribute or collaborate.