Skip to content

Instantly share code, notes, and snippets.

@tdtds
Last active December 17, 2015 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdtds/5609096 to your computer and use it in GitHub Desktop.
Save tdtds/5609096 to your computer and use it in GitHub Desktop.
puppet内からpuppet moduleのインストールを管理する
define puppet::module(
$ensure = installed,
){
$module = regsubst($name, '^.*?-(.*)$', '\1')
if $ensure == installed {
exec { "install":
path => ['/bin', '/usr/local/bin'],
command => "puppet module install ${name}",
creates => "/etc/puppet/modules/${module}",
}
}else{
exec { "uninstall":
path => ['/usr/bin', '/usr/local/bin'],
command => "puppet module uninstall ${name}",
onlyif => "test -d /etc/puppet/modules/${module}",
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment