Olá, Laís, eu achei que esse outro curso de Vagrant era uma continuação desse que estou fazendo. De toda forma vi que existiam erros de sintaxe e corrigi esses erros, mas ainda assim, o sql apresenta erro de tabela inexistente, o curso não aborda essa parte, nem explica sobre select e comandos dentro do mysql e eu não entendo nada de mysql. Os arquivos de vagrant e de puppet estão abaixo:
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise32"
config.vm.define :web do |web_config|
#web_config.vm.network "forwarded_port", guest: 8080, host: 8081
web_config.vm.network "private_network", ip: "192.168.56.10"
web_config.vm.provision "shell", inline: "sudo apt-get update && sudo apt-get install -y puppet"
end
end
exec { "apt-update":
command => "/usr/bin/apt-get update"
}
package { ["openjdk-7-jre", "tomcat7", "mysql-server"]:
ensure => installed,
require => Exec["apt-update"]
}
service { "tomcat7":
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
require => Package["tomcat7"]
}
file { "/var/lib/tomcat7/webapps/vraptor-musicjungle.war":
source => "/vagrant/manifests/vraptor-musicjungle.war",
owner => "tomcat7",
group => "tomcat7",
mode => 0644,
require => Package["tomcat7"],
notify => Service["tomcat7"]
}
service { "mysql":
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
require => Package["mysql-server"]
}
exec { "musicjungle":
command => "mysqladmin -u root create musicjungle",
unless => "mysql -u root musicjungle",
path => "/usr/bin",
require => Service["mysql"]
}
#exec { "mysql-password" :
# command => "mysql -uroot -e \"GRANT ALL PRIVILEGES ON * TO 'musicjungle'@'%' IDENTIFIED BY 'minha-senha';\" musicjungle",
# unless => "mysql -umusicjungle -pminha-senha musicjungle",
#path => "/usr/bin",
#require => Exec["musicjungle"]
#}
file_line { "production":
file => "/etc/default/tomcat7",
line => "JAVA_OPTS=\"\$JAVA_OPTS -Dbr.com.caelum.vraptor.environment=production\"",
require => Package["tomcat7"],
notify => Service["tomcat7"]
}
define file_line($file, $line) {
exec { "/bin/echo '$line' >> '$file'":
unless => "/bin/grep -qfx '$(line)' '$(file)'"
}
}