Last active
December 17, 2015 12:19
-
-
Save tdtds/5609096 to your computer and use it in GitHub Desktop.
puppet内からpuppet moduleのインストールを管理する
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
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