6
respostas

Aula 6 - shared folder na aws.

Oi, pessoal! Depois de muito custo consegui aplicar o "vagrant up --provider=aws" e criar automaticamente minha maquina na amazon. Para tal tive primeiro que consertar dois bugs que surgiram aqui pra mim. Tive que instalar dois plugins do vagrant. Abaixo segue a lista de plugins:

notebookpreto@notebookpretoPC MINGW64 ~ $ vagrant plugin list nokogiri (1.6.7.1) <== esse aqui! - Version Constraint: 1.6.7.1 vagrant-aws (0.7.0) vagrant-share (1.1.5, system) vagrant-winnfsd (1.1.0) <== esse aqui!

Meu Vagrantfile segue abaixo:

Vagrant.configure(2) do |config| config.vm.box = "ubuntu_aws" config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"

config.vm.synced_folder ".", "/vagrant", type: "nfs"

config.vm.provider :aws do |aws, override| aws.access_key_id = "AKIAJ6ED5JIZ6OKHC6BQ" aws.secret_access_key = "aKC5ZxsCpfKi+0C8zfadsW2y9nyAB9fQBzFlLrt1"

aws.keypair_name = "devops" aws.ami = "ami-0fb83963" aws.security_groups = ['devops'] aws.region = "sa-east-1"

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

config.vm.define :web do |web_config| web_config.vm.network "private_network", ip: "192.168.50.10", type: "dhcp"

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 end

Não vi a criação do synced folder. E por isso não tive a execução do provision "manifests/bootstrap.sh" e muito menos a execução do arquivo web.pp.

Pelo visto me parece que há algo faltando para funcionar o arquivo compartilhado com minha máquina na amazon.

Podem me ajudar a resolver esse problema?

6 respostas

Outra coisa, por favor não tentem usar minha Access Key ID. Já deletei!

Obrigado a quem puder me ajudar nessa dúvida.

Marcus você consegue colar o log gerado do vagrant no terminal/prompt ? Assim podemos te ajudar melhor.

Caio, desculpa a demora pra responder. Segue o log do vagrant up --provider=aws:

notebookpreto@notebookpretoPC MINGW64 ~/Desktop/vagrant/devops
$ vagrant up --provider=aws
Bringing machine 'web' up with 'aws' provider...
C:/Users/notebookpreto/.vagrant.d/gems/gems/vagrant-aws-0.7.0/lib/vagrant-aws/action/run_instance.rb:98: warning: duplicated key at line 100 ignored: :associate_public_ip
==> web: Warning! The AWS provider doesn't support any of the Vagrant
==> web: high-level network configurations (`config.vm.network`). They
==> web: will be silently ignored.
==> web: Launching an instance with the following settings...
==> web:  -- Type: m3.medium
==> web:  -- AMI: ami-0fb83963
==> web:  -- Region: sa-east-1
==> web:  -- Keypair: devops
==> web:  -- Security Groups: ["devops"]
==> web:  -- Block Device Mapping: []
==> web:  -- Terminate On Shutdown: false
==> web:  -- Monitoring: false
==> web:  -- EBS optimized: false
==> web:  -- Source Destination check:
==> web:  -- Assigning a public IP address in a VPC: false
==> web:  -- VPC tenancy specification: default
==> web: Waiting for instance to become "ready"...
==> web: Waiting for SSH to become available...
==> web: Machine is booted and ready for use!
No host IP was given to the Vagrant core NFS helper. This is
an internal error that should be reported as a bug.

A máquina inicializa numa boa, o problema é que não vejo a pasta sincronizada sendo criada como gostaria e aí nem adianta tentar rodar o puppet pois a "synced folder" não existe na máquina recém criada na amazon.

Parece que o log não deu muitas dicas, mas vendo a documentação do mitchellh no github é citado que temos que instalar um tal de rsync para fazer a operação. Você tem esse cara ai no seu windows ?

https://github.com/mitchellh/vagrant-aws#user-content-synced-folders

Outra coisa é fazer um vagrant up --provider=aws --debug para ver se temos um log mais completo.

Pode fazer isso ?

Bom, eu não tinha o rsync instalado então instalei via Cygwin (https://cygwin.com/install.html). e depois coloquei a pasta C:\cygwin64\bin no meu PATH, conforme manda o figurino. Em seguida adicionei a seguinte linha no meu Vagrantfile:

config.vm.synced_folder ".", "/vagrant", type: "rsync"

E agora com o rsync configurado, rodei mais uma vez o vagrant up --provider=aws:

notebookpreto@notebookpretoPC MINGW64 ~/Desktop/vagrant/devops
$ vagrant up --provider=aws
Bringing machine 'web' up with 'aws' provider...
C:/Users/notebookpreto/.vagrant.d/gems/gems/vagrant-aws-0.7.0/lib/vagrant-aws/action/run_instance.rb:98: warning: duplicated key at line 100 ignored: :associate_public_ip
==> web: Warning! The AWS provider doesn't support any of the Vagrant
==> web: high-level network configurations (`config.vm.network`). They
==> web: will be silently ignored.
==> web: Launching an instance with the following settings...
==> web:  -- Type: m3.medium
==> web:  -- AMI: ami-0fb83963
==> web:  -- Region: sa-east-1
==> web:  -- Keypair: devops
==> web:  -- Security Groups: ["devops"]
==> web:  -- Block Device Mapping: []
==> web:  -- Terminate On Shutdown: false
==> web:  -- Monitoring: false
==> web:  -- EBS optimized: false
==> web:  -- Source Destination check:
==> web:  -- Assigning a public IP address in a VPC: false
==> web:  -- VPC tenancy specification: default
==> web: Waiting for instance to become "ready"...
==> web: Waiting for SSH to become available...
==> web: Machine is booted and ready for use!
==> web: Rsyncing folder: /c/Users/notebookpreto/Desktop/vagrant/devops/ => /vagrant
There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.

Host path: /c/Users/notebookpreto/Desktop/vagrant/devops/
Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links --chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 22 -o ControlMaster=auto -o ControlPath=C:/Users/NOTEBO~1/AppData/Local/Temp/ssh.830 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/Users/notebookpreto/Desktop/vagrant/devops/devops.pem' --exclude .vagrant/ /c/Users/notebookpreto/Desktop/vagrant/devops/ ubuntu@ec2-52-67-82-135.sa-east-1.compute.amazonaws.com:/vagrant
Error:       1 [main] ssh (6396) C:\Program Files\Git\usr\bin\ssh.exe: *** fatal error - cygheap base mismatch detected - 0x18033E400/0x180321400.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.
rsync: safe_read failed to read 4 bytes [sender]: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(276) [sender=3.1.1]

E agora temos um novo bug :(

Como acabei de instalar o Cygwin não entendo porque tem conflito.

Tem alguma dica?

Obg!

Que estranho,

Chegou a fazer o que o log recomendou ? Ver se tem mais de uma dll do cygwin na pasta bin, se houver, apagar tudo menos a dll mais recente(direito na dll, propriedades , guia versões), depois reiniciar.

Se não rolar, a minha sugestão seria desinstalar o cywing e procurar ou software que tem o rsync : https://www.hashicorp.com/blog/feature-preview-vagrant-1-5-rsync.html

no link é recomendado msysgit, MimGW

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