Browse Source

Setup inicial do Vagrant

producao
Marcio Mazza 10 years ago
parent
commit
8090eee0ce
  1. 1
      .gitignore
  2. 19
      Vagrantfile
  3. 17
      puppet/bootstrap.sh
  4. 5
      puppet/manifests/site.pp
  5. 1
      www_temp/index.html

1
.gitignore

@ -43,3 +43,4 @@ media/
.project .project
.pydevproject .pydevproject
.vagrant

19
Vagrantfile

@ -0,0 +1,19 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provision :shell, :path => "puppet/bootstrap.sh"
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "site.pp"
end
end

17
puppet/bootstrap.sh

@ -0,0 +1,17 @@
#!/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

5
puppet/manifests/site.pp

@ -0,0 +1,5 @@
class { 'nginx': }
nginx::resource::vhost { 'localhost':
www_root => '/vagrant/www_temp',
}

1
www_temp/index.html

@ -0,0 +1 @@
Teste
Loading…
Cancel
Save