3
respostas

Apos rodar vagrant provision... erro "shared folders missing"

Apos rodar vagrant provision, consigo ate rodar o script bootstrap mas provavelmente na hora do scp vem o erro:

Shared folders that Puppet requires are missing on the virtual machine. This is usually due to configuration changing after already booting the machine. The fix is to run a vagrant reload so that the proper shared folders will be prepared and mounted on the VM.

Ja' dei o comando reload e provison de novo mas nada!!!

Se alguem teve esse mesmo problema por favor, gostaria de uma ajuda pois ja tentei varias configuracoes.

Obrigado

3 respostas

Oi Orlando, tudo bem? Estranho isso, mas você tem a pasta criada? como está seu Vagrantfile?

Olá Wanderson!

Sim, eu tenho a pasta criada. Vagranfile:

Vagrant.configure("2") do |config|
       config.vm.box = "ubuntu/xenial64"

       config.vm.define :web do |web_config|
          web_config.vm.network "private_network", ip: "192.168.50.10"
          web_config.vm.provision "puppet" do |puppet|
             puppet.manifest_file = "web.pp"
          end 
       end 

       config.vm.provision "shell", inline: "apt-get update && apt-get install -y puppet"
end

e dentro do subdir manifest: web.pp:

exec { "apt-update":
    command => "/usr/bin/apt-get update"
}
package { ["openjdk-8-jre", "tomcat8", "mysql-server", "htop"]:
    ensure => installed,
    require => Exec["apt-update"]
}

service { "tomcat8":
    ensure => running,
    enable => true,
    hasstatus => true,
    hasrestart => true, 
    require => Package["tomcat8"]
}

file { "/var/lib/tomcat8/webapps/vraptor-musicjungle.war":
    source => "/vagrant/manifests/vraptor-musicjungle.war",
    owner => tomcat8,
    group => tomcat8,
    mode => 0644,
    require => Package["tomcat8"],
    notify => Service["tomcat8"]
}

service { "mysql":
    ensure => running,
    enable => true,
    hasstatus => true,
    hasrestart => true, 
    require => Package["mysql-server"]
}

exec { "musicjungle":
    command => "mysqladmin -uroot 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"]
}


define file_line($file, $line) {
    exec { "/bin/echo '${line}' >> '${file}'":
        unless => "/bin/grep -qFx '${line}' '${file}'"
    }   
}

file_line { "production":
    file => "/etc/default/tomcat8",
    line => "JAVA_OPTS=\"\$JAVA_OPTS -Dbr.com.caelum.vraptor.environment=production\"",
    require => Package["tomcat8"],
    notify => Service["tomcat8"]
}

e o bootstrap.sh:

#!/bin/sh
set -e -x

if which puppet > /dev/null ; then
    echo "Puppet is already installed"
    exit 0
fi

apt-get update
apt-get install -y aptitude

export DEBIAN_FRONTEND=noninteractive
wget -qO /tmp/puppetlabs-release-precise.deb https://apt.puppetlabs.com/puppetlabs-release-precise.deb

dpkg -i /tmp/puppetlabs-release-precise.deb
rm /tmp/puppetlabs-release-precise.deb
aptitude update
echo Installing puppet
aptitude install -y puppet
echo "Puppet installed!"

Obrigado pela atencao

Essa linha do bootstrap.sh está sem aspas, será que ela tá fazendo o resto dar errado?

echo Installing puppet não deveria ser: echo "Installing puppet"?

Tenta verificar se depois que executa o bootstrap.sh o puppet realmente está instalado. Se usar o comando wicth puppet deve aparecer o caminho do binário do puppet, isso confirma a instalação.