From 68e1e75e028608e8ed66ca591ebca8836f85f8bf Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Fri, 5 Sep 2014 16:53:10 -0300 Subject: [PATCH] =?UTF-8?q?Script=20para=20instala=C3=A7=C3=A3o=20de=20mod?= =?UTF-8?q?ulo=20puppet=20do=20github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Vagrantfile | 5 ++++- puppet/bootstrap.sh | 17 --------------- puppet/puppet_module_install_from_github.sh | 23 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 18 deletions(-) delete mode 100755 puppet/bootstrap.sh create mode 100755 puppet/puppet_module_install_from_github.sh diff --git a/Vagrantfile b/Vagrantfile index 9c36bbc..883a652 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -9,7 +9,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.network :forwarded_port, guest: 80, host: 8080 - config.vm.provision :shell, :path => "puppet/bootstrap.sh" + # config.vm.provision :shell, :path => "puppet/bootstrap.sh" + config.vm.provision :shell, + :path => "puppet/puppet_module_install_from_github.sh", + :args => "jfryman-nginx interlegis/puppet-nginx" config.vm.provision :puppet do |puppet| puppet.manifests_path = "puppet/manifests" diff --git a/puppet/bootstrap.sh b/puppet/bootstrap.sh deleted file mode 100755 index a399f61..0000000 --- a/puppet/bootstrap.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -puppet_nginx_instalado=$( puppet module list | grep -ic nginx ) - -if [ $puppet_nginx_instalado -eq 0 ] -then - TAR_FILE=/tmp/puppet-nginx.tar.gz - - wget https://github.com/interlegis/puppet-nginx/archive/master.tar.gz -O $TAR_FILE - rm -fr /tmp/puppet-nginx-master - tar -C /tmp -xf $TAR_FILE - - echo 'Building module puppet-nginx...' - TAR_MODULE=$(puppet module build /tmp/puppet-nginx-master | grep 'Module built' | cut -d\ -f 3) - echo 'Installing module puppet-nginx from ' $TAR_MODULE ' ...' - puppet module install $TAR_MODULE -fi diff --git a/puppet/puppet_module_install_from_github.sh b/puppet/puppet_module_install_from_github.sh new file mode 100755 index 0000000..c595d7b --- /dev/null +++ b/puppet/puppet_module_install_from_github.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# argumentos: + +nome_modulo=$1 +github_path=$2 +nome_repo=$(echo $github_path | cut -d / -f 2) + +modulo_instalado=$( puppet module list | grep -ic $nome_modulo ) + +if [ $modulo_instalado -eq 0 ] +then + TAR_FILE="/tmp/$nome_modulo.tar.gz" + + wget "https://github.com/$github_path/archive/master.tar.gz" -O $TAR_FILE + rm -fr "/tmp/$nome_repo-master" + tar -C /tmp -xf $TAR_FILE + + echo "Building module $nome_modulo..." + TAR_MODULE=$(puppet module build "/tmp/$nome_repo-master" | grep 'Module built' | cut -d\ -f 3) + echo "Installing module $nome_modulo from " $TAR_MODULE ' ...' + puppet module install $TAR_MODULE +fi +