Vagrant with puppet provisioning issues

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Vagrant with puppet provisioning issues

groovybayo
Hi -
I am just getting started with vagrant and having some difficulties getting it going. I currently have v. 1.1.2 installed on my mac.

I am provisioning the box with puppet and have a simple manifest like so:

class simple {
        include apt
        package {
["vim", "curl"]:
ensure => present,
require => Exec["apt-get update"]
}
        exec {
"download_jmeter":
command => "curl -L http://www.bizdirusa.com/mirrors/apache//jmeter/binaries/apache-jmeter-2.9.tgz | tar zx",
cwd => "/vagrant",
user => "vagrant",
path => "/usr/bin/:/bin",
logoutput => true,
creates => "/vagrant/jmeter-2.9"
}
}

when i run vagrant up, i don't get any errors. If I ssh into the created box, all I see if a 'postinstall.sh' file. Shouldn't that file be automatically executed by vagrant?

When I try to execute it manually myself, I get errors...

vagrant@precise32:~$ ./postinstall.sh
++ sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
sed: can't read /etc/sudoers: Permission denied
++ case "$platform" in
++ groupadd -r admin
groupadd: group 'admin' already exists
++ true
++ usermod -a -G admin vagrant
usermod: cannot lock /etc/passwd; try again later.
++ sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=(ALL) NOPASSWD:ALL/g' /etc/sudoers
sed: can't read /etc/sudoers: Permission denied
++ echo 'LC_ALL="en_US"'
./postinstall.sh: line 51: /etc/default/locale: Permission denied
++ case "$platform" in
++ apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev make curl git-core
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
++ clone_dir=/tmp/ruby-build-1502
++ git clone https://github.com/sstephenson/ruby-build.git /tmp/ruby-build-1502
./postinstall.sh: line 79: git: command not found
++ /tmp/ruby-build-1502/bin/ruby-build 1.8.7-p358 /opt/vagrant_ruby
./postinstall.sh: line 80: /tmp/ruby-build-1502/bin/ruby-build: No such file or directory
++ rm -rf /tmp/ruby-build-1502
++ unset clone_dir
++ /opt/vagrant_ruby/bin/gem install polyglot net-ssh-gateway mime-types --no-ri --no-rdoc
Fetching: polyglot-0.3.3.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /opt/vagrant_ruby/lib/ruby/gems/1.8 directory.
++ /opt/vagrant_ruby/bin/gem install chef --no-ri --no-rdoc
Fetching: mixlib-cli-1.3.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /opt/vagrant_ruby/lib/ruby/gems/1.8 directory.
++ /opt/vagrant_ruby/bin/gem install puppet --no-ri --no-rdoc
Fetching: json_pure-1.7.7.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /opt/vagrant_ruby/lib/ruby/gems/1.8 directory.
++ groupadd puppet
groupadd: group 'puppet' already exists
++ echo 'PATH=$PATH:/opt/vagrant_ruby/bin'
./postinstall.sh: line 102: /etc/profile.d/vagrant_ruby.sh: Permission denied
++ vssh=/home/vagrant/.ssh
++ mkdir -p /home/vagrant/.ssh
++ chmod 700 /home/vagrant/.ssh
++ cd /home/vagrant/.ssh
++ wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
--2013-03-20 15:56:42--  https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub
Resolving raw.github.com (raw.github.com)... 199.27.72.133
Connecting to raw.github.com (raw.github.com)|199.27.72.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 409 [text/plain]
Saving to: `/home/vagrant/.ssh/authorized_keys'

100%[======================================>] 409         --.-K/s   in 0s

2013-03-20 15:56:42 (23.0 MB/s) - `/home/vagrant/.ssh/authorized_keys' saved [409/409]

++ chmod 0600 /home/vagrant/.ssh/authorized_keys
++ chown -R vagrant:vagrant /home/vagrant/.ssh
++ unset vssh
++ apt-get -y remove virtualbox-ose-guest-dkms
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
++ apt-get -y remove virtualbox-ose-guest-utils
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
+++ uname -r
++ apt-get -y install linux-headers-3.2.0-23-generic-pae
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
+++ cat /home/vagrant/.vbox_version
++ VBOX_VERSION=4.2.0
++ mount -o loop /home/vagrant/VBoxGuestAdditions_4.2.0.iso /mnt
mount: only root can do that
++ sh /mnt/VBoxLinuxAdditions.run
++ yes
sh: 0: Can't open /mnt/VBoxLinuxAdditions.run
++ umount /mnt
umount: /mnt is not mounted (according to mtab)
++ rm -f /home/vagrant/VBoxGuestAdditions_4.2.0.iso
+++ uname -r
++ apt-get -y remove linux-headers-3.2.0-23-generic-pae
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
++ apt-get -y install nfs-common
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
++ echo 'UseDNS no'
./postinstall.sh: line 149: /etc/ssh/sshd_config: Permission denied
++ case "$platform" in
++ echo 'Welcome to your Vagrant-built virtual machine.'
./postinstall.sh: line 157: /etc/motd.tail: Permission denied
++ date
./postinstall.sh: line 162: /etc/vagrant_box_build_time: Permission denied
++ cat
./postinstall.sh: line 166: /etc/rc.local: Permission denied
++ apt-get -y remove build-essential make curl git-core
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
++ apt-get -y autoremove
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
++ apt-get -y clean
E: Could not open lock file /var/cache/apt/archives/lock - open (13: Permission denied)
E: Unable to lock the download directory
++ rm -f '/var/lib/dhcp3/*'
++ rm /etc/udev/rules.d/70-persistent-net.rules
rm: cannot remove `/etc/udev/rules.d/70-persistent-net.rules': Is a directory
++ mkdir /etc/udev/rules.d/70-persistent-net.rules
mkdir: cannot create directory `/etc/udev/rules.d/70-persistent-net.rules': File exists
++ rm -rf /dev/.udev/
rm: cannot remove `/dev/.udev/rules.d/root.rules': Permission denied
++ rm /lib/udev/rules.d/75-persistent-net-generator.rules
rm: cannot remove `/lib/udev/rules.d/75-persistent-net-generator.rules': No such file or directory
++ rm -f '/home/vagrant/*.iso' /home/vagrant/postinstall.sh
++ dd if=/dev/zero of=/EMPTY bs=1M
dd: opening `/EMPTY': Permission denied
++ rm -f /EMPTY
++ exit


Secondly, another issue, which may be related to the one above is, when i do ruby -v on my system, it still reports 
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

and the vagrant command can still run. I have attempted to switch to ruby 1.9.3 with rvm and run vagrant with that to no avail.

rvm use 1.9.3
Using /Users/groovybayo/.rvm/gems/ruby-1.9.3-p392
book-setup ❯ vagrant -v
/Users/groovybayo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find vagrant (>= 0) amongst [bigdecimal-1.1.0, bundler-1.3.4, bundler-1.3.2, childprocess-0.3.9, contest-0.1.3, diff-lcs-1.1.3, erubis-2.7.0, ffi-1.4.0, i18n-0.6.4, io-console-0.3, json-1.7.7, json-1.5.5, log4r-1.1.10, metaclass-0.0.1, minitest-2.5.1, mocha-0.13.3, net-scp-1.0.4, net-ssh-2.2.2, rake-10.0.3, rake-0.9.2.2, rdoc-3.9.5, rspec-core-2.11.1, rspec-expectations-2.11.3, rspec-mocks-2.11.3, rubygems-bundler-1.1.1, rvm-1.11.3.6] (Gem::LoadError)
from /Users/groovybayo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/groovybayo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
from /Users/groovybayo/.rvm/gems/ruby-1.9.3-p392/bin/vagrant:18:in `<main>'
from /Users/groovybayo/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/groovybayo/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'

Any help will be greatly appreciated. Thanks in advance

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.