1
resposta

Problema ao rodar o bootstrap.sh (instalar puppet) na EC2

Oi,

Consegui subir minha VM na EC2!!!

Agora parei no problema seguinte: Sinto que meu script de instalação do puppet esta com algum erro simples. Eh como se ele estivesse executando os comandos atropeladamente, partindo para a linha de baixo antes do terminal concluir a execução da linha de cima. Segue meu arquivo manifests/bootstrap.sh e a saída do terminal:

#!/bin/sh
set -e -x

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

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

dpkg -i /tmp/puppetlabs-release-xenial.deb
rm /tmp/puppetlabs-release-xenial.deb
echo Installing puppet
apt-get install -y augeas-lenses libaugeas0 libxslt1.1 puppet puppet-common ruby-augeas ruby-nokogiri ruby-rgen ruby-safe-yaml ruby-selinux
echo "Puppet installed!"
lamps@pc:~/dev/musicjungle$ vagrant up --provider=aws
Bringing machine 'web' up with 'aws' provider...
==> 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: t2.micro
==> web:  -- AMI: ami-916f59f4
==> web:  -- Region: us-east-2
==> 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: /home/lamps/dev/musicjungle/ => /vagrant
==> web: Rsyncing folder: /home/lamps/dev/musicjungle/manifests/ => /tmp/vagrant-puppet/manifests-a11d1078b1b1f2e3bdea27312f6ba513
==> web: Running provisioner: shell...
    web: Running: /tmp/vagrant-shell20180508-14561-770pcw.sh
    web: + 
    web: which
    web:  puppet
    web: + export DEBIAN_FRONTEND=noninteractive
    web: + wget -qO /tmp/puppetlabs-release-xenial.deb https://apt.puppetlabs.com/puppet5-release-xenial.deb
    web: + dpkg -i /tmp/puppetlabs-release-xenial.deb
    web: Selecting previously unselected package puppet5-release.
    web: (Reading database ... 51142 files and directories currently installed.)
    web: Preparing to unpack .../puppetlabs-release-xenial.deb ...
    web: Unpacking puppet5-release (5.0.0-1xenial) ...
    web: Setting up puppet5-release (5.0.0-1xenial) ...
    web: + rm /tmp/puppetlabs-release-xenial.deb
    web: Installing puppet
    web: + echo Installing puppet
    web: + apt-get install -y augeas-lenses libaugeas0 libxslt1.1 puppet puppet-common ruby-augeas ruby-nokogiri ruby-rgen ruby-safe-yaml ruby-selinux
    web: Reading package lists...
    web: Building dependency tree...
    web: Reading state information...
    web: E
    web: : 
    web: Unable to locate package puppet
    web: E
    web: : 
    web: Unable to locate package puppet-common
    web: E
    web: : 
    web: Unable to locate package ruby-augeas
    web: E
    web: : 
    web: Unable to locate package ruby-nokogiri
    web: E
    web: : 
    web: Unable to locate package ruby-rgen
    web: E
    web: : 
    web: Unable to locate package ruby-safe-yaml
    web: E
    web: : 
    web: Unable to locate package ruby-selinux
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
went wrong.

Peguei este problema com o script que outro aluno postou aqui no fórum (acho que o Nelson). Com o script padrão do curso eu pego aquele erro por o aptitude não vir mais instalado por padrão nos Ubuntu atuais.

1 resposta

Opa Bruno, acho que mesmo instalando as listas do .deb, você precisa rodar um apt-get update antes de mandar instalar. Ele não está encontrando os pacotes e deve ser por causa disso.