3
respostas

vagrant plugin install vagrant-aws não funciona

O comando:

vagrant plugin install vagrant-aws

não funciona mesmo após executar o comando:

sudo apt-get install ruby-dev

O erro que dá é:

Installing the 'vagrant-aws' plugin. This can take a few minutes...
/usr/lib/ruby/2.3.0/rubygems/specification.rb:946:in `all=': undefined method `group_by' for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:275:in `with_isolated_gem'
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:231:in `internal_install'
    from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:102:in `install'
    from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:62:in `block in install_plugin'
    from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:72:in `install_plugin'
    from /usr/share/vagrant/plugins/commands/plugin/action/install_gem.rb:37:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/warden.rb:34:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/builder.rb:116:in `call'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `block in run'
    from /usr/lib/ruby/vendor_ruby/vagrant/util/busy.rb:19:in `busy'
    from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/plugins/commands/plugin/command/base.rb:14:in `action'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:32:in `block in execute'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `each'
    from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `execute'
    from /usr/share/vagrant/plugins/commands/plugin/command/root.rb:56:in `execute'
    from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:42:in `execute'
    from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:268:in `cli'
    from /usr/bin/vagrant:173:in `<main>'

Tentei também o dpkg da versão 1.8.0 do vagrant, funciona o install do plugin do aws, mas aí fica aparecendo o erro do gruoupId não pode ser nulo, como se não entendesse o nome do grupo de permissão da Amazon.

3 respostas

Tem varias pessoas que reclamam desse erro, e a sugestão que melhor funciona é reinstalar o pacote do vagrant direto do site

https://www.vagrantup.com/downloads.html

Tentei pelo site, a versão que tem lá é a 1.9.1, apt-get pega a 1.8.1.

Porém apareceu erro de permission denied.

Executei como sudo e mesmo assim ainda da erro.

O erro agora é esse:

==> web: Warning! Vagrant might not be able to SSH into the instance.
==> web: Please check your security groups settings.
There was an error talking to AWS. The error message is shown
below:

InvalidParameterValue => Value () for parameter groupId is invalid. The value cannot be empty

Acho que consegui.

Algumas coisas que estava fazendo errado: - Meu ami (imagem) estava um idname e eu estava em outra região, estava em oregon; - Tive que criar uma KeyPair, Access key id e security id correta na região certa agora (south america São Paulo); - Tive que setar a região correta no VagrantFile, peguei na url da amazon, fica lá quando muda de região; - Tive que simular a criação de um ubuntu pelo site para pegar o ami certo da minha região; - Tive que setar o instance type para que não fosse criado o default m3.medium, medo de pagar pela máquina. Consegui setar para o t2.micro.

Segue como ficou meu VagrantFile com exemplo:

Vagrant.configure("2") do |config|

    config.ssh.pty = true
    config.vm.box = "ubuntu_aws"
    config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
    config.vm.define :web do |web_config|
        web_config.vm.network "private_network", ip: "192.168.50.10"
        web_config.vm.provision "shell", path: "manifests/bootstrap.sh"
        web_config.vm.provision "puppet" do |puppet|
            puppet.manifest_file = "web.pp"
        end
        web_config.vm.provider :aws do |aws|
            aws.tags = { 'Name' => 'MusicJungle (vagrant)'}
        end
    end
    config.vm.provider :aws do |aws, override|
        aws.access_key_id = 'SEU KEY ID'
        aws.secret_access_key = 'SEU SECRET KEY'

        aws.keypair_name = "KeyPairLocal"
        aws.ami = "ami-7379e31f"
        aws.instance_type = "t2.micro"
        aws.region = "sa-east-1"
        aws.security_groups = ['webaccess']

        override.ssh.username = "ubuntu"
        override.ssh.private_key_path = "KeyPairLocal.pem"
    end
end

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