1
resposta

EH IRRITANTE DEMAIS

As coisas continuam dando erro, seja euy fazendo manualmente cada linha, ou no iutro projeto onde simplemente copio e colo, não há solução na materia do curso para os erros, o proprio curso ta defasado....

me sinto um macaco que copia e cola do que um aprendizado.... EH IRRITANTE DEMAIS

==> web: /usr/lib/ruby/vendor_ruby/puppet/util.rb:357: warning: URI.unescape is obsolete ==> web: Error: /Stage[main]/Main/File[/var/lib/tomcat9/webapps/vraptor-musicjungle.war]: Could not evaluate: Could not retrieve information from environment production source(s) file:///Vagrant/manifests/vraptor-musicjungle.war ==> web: Notice: /Stage[main]/Main/Service[tomcat9]: Dependency File[/var/lib/tomcat9/webapps/vraptor-musicjungle.war] has failures: true ==> web: Warning: /Stage[main]/Main/Service[tomcat9]: Skipping because of failed dependencies ==> web: Notice: /Stage[main]/Main/Exec[musicjungle]/returns: executed successfully ==> web: Notice: /Stage[main]/Main/Exec[mysql-password]/returns: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'minha-senha'' at line 1 ==> web: Error: 'mysql -uroot -e "GRANT ALL PRIVILEGES ON * TO 'musicjungle'@'%' IDENTIFIED BY 'minha-senha';" musicjungle' returned 1 instead of one of [0] ==> web: Error: /Stage[main]/Main/Exec[mysql-password]/returns: change from 'notrun' to ['0'] failed: 'mysql -uroot -e "GRANT ALL PRIVILEGES ON * TO 'musicjungle'@'%' IDENTIFIED BY 'minha-senha';" musicjungle' returned 1 instead of one of [0] ==> web: /usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0 ==> web: Notice: Applied catalog in 218.89 seconds ==> web: /usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0 ==> web: /usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil ==> web: /usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0 ==> web: /usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0 The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what

WEB.PP
#ESSE SCRIPT EH CHAMADO DE DENTRO DA VM
#sudo puppet apply /vagrant/manifests/web.pp

exec { "apt-update":
  command => "/usr/bin/apt-get update",
}

package { ["default-jdk", "tomcat9", "mysql-server"]:
    ensure => installed,
    require => Exec["apt-update"]
}

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

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

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"]
  }
Vagrant.configure('2') do |config|
  config.vm.box = "ubuntu/focal64"

  config.vm.define :web do |web_config|
    web_config.vm.network "private_network", ip: "192.168.50.10"
    # PRoVISIONANDO E INSTALANDO O Puppet
    web_config.vm.provision "shell",
    inline: "sudo apt-get update && sudo apt-get install -y puppet"

    web_config.vm.provision "puppet" do |puppet|
      puppet.manifests_path = "./manifests"
      puppet.manifest_file = "web.pp"
    end
  end
end
#NOVA MAQUINA, PARA ESTUDO DE ENCAMINHAMENTO POR PORTA
Vagrant.configure('2') do |caminho|
  caminho.vm.box =  "ubuntu/focal64"

  caminho.vm.define :cforw do |cforw_caminho|
    cforw_caminho.vm.network "forwarded_port", guest: 8080, host:8081
    cforw_caminho.vm.network "private_network", ip: "192.168.50.20"

    cforw_caminho.vm.provision "shell", inline:"sudo apt-get update && sudo apt-get install -y puppet"
    cforw_caminho.vm.provision "shell", inline: "sudo puppet apply /Vagrant/manifests/meuscripweb.pp"
  end
end
1 resposta

Opa! Blz?

No seu script tem um erro: Falta o espaço do -u na instrução. Aqui oh! command => "mysql -uroot

A exceção foi essa: line 1: You have an error in your SQL syntax; check the manual that corresponds to ...

Justamente por causa da instrução sem o espaço.

Senão houver outro erro deva executar, ele não tá executando isso aí.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software