diff --git a/.gitignore b/.gitignore index 3e6b8f0..389824f 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,4 @@ media/ .project .pydevproject +.vagrant diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..9c36bbc --- /dev/null +++ b/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 diff --git a/puppet/bootstrap.sh b/puppet/bootstrap.sh new file mode 100755 index 0000000..a399f61 --- /dev/null +++ b/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 diff --git a/puppet/manifests/site.pp b/puppet/manifests/site.pp new file mode 100644 index 0000000..4b33323 --- /dev/null +++ b/puppet/manifests/site.pp @@ -0,0 +1,5 @@ +class { 'nginx': } + +nginx::resource::vhost { 'localhost': + www_root => '/vagrant/www_temp', +} diff --git a/www_temp/index.html b/www_temp/index.html new file mode 100644 index 0000000..9f410cf --- /dev/null +++ b/www_temp/index.html @@ -0,0 +1 @@ +Teste