blalor / vagrant-puppet-example

Example Puppet config that can be reused between Vagrant and "real" systems
31 stars 2 forks source link

Hiera facts not found on vagrant up #1

Open jeekl opened 10 years ago

jeekl commented 10 years ago

Something probably changed in how vagrant handles hiera. Just checking out the repo and running vagrant up gives me this error:

% vagrant up        
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'CentOS-6.3-x86_64-reallyminimal'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2200.
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2200 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
prevent things such as shared folders from working properly. If you see
shared folder errors, please make sure the guest additions within the
virtual machine match the version of VirtualBox you have installed on
your host and reload your VM.

Guest Additions Version: 4.2.6
VirtualBox Version: 4.3
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-puppet-1/manifests
[default] -- /tmp/vagrant-puppet-1/modules-0
[default] Running provisioner: puppet...
Running Puppet with default.pp...
Warning: Config file /home/vagrant/hiera.yaml not found, using Hiera defaults
Error: Must pass public_hostname to Class[Role::Ui] at /tmp/vagrant-puppet-1/manifests/default.pp:11 on node vagrant-centos63.vagrantup.com
Error: Must pass public_hostname to Class[Role::Ui] at /tmp/vagrant-puppet-1/manifests/default.pp:11 on node vagrant-centos63.vagrantup.com
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

FACTER_is_vagrant='true' puppet apply --hiera_config hiera.yaml --modulepath '/tmp/vagrant-puppet-1/modules-0' --manifestdir /tmp/vagrant-puppet-1/manifests --detailed-exitcodes /tmp/vagrant-puppet-1/manifests/default.pp || [ $? -eq 2 ]

Stdout from the command:

Stderr from the command:

Warning: Config file /home/vagrant/hiera.yaml not found, using Hiera defaults
Error: Must pass public_hostname to Class[Role::Ui] at /tmp/vagrant-puppet-1/manifests/default.pp:11 on node vagrant-centos63.vagrantup.com
Error: Must pass public_hostname to Class[Role::Ui] at /tmp/vagrant-puppet-1/manifests/default.pp:11 on node vagrant-centos63.vagrantup.com

The line Warning: Config file /home/vagrant/hiera.yaml not found, using Hiera defaults looks worrying...

However, logging into the machine and running the same command works:

% vagrant ssh
Last login: Thu Jan  3 14:26:58 2013 from 10.0.2.2
Welcome to your Vagrant-built virtual machine.
[vagrant@vagrant-centos63 ~]$ mount
/dev/mapper/vg_vagrantcentos63-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/vagrant on /vagrant type vboxsf (uid=500,gid=500,rw)
/tmp/vagrant-puppet-1/manifests on /tmp/vagrant-puppet-1/manifests type vboxsf (gid=500,rw)
/tmp/vagrant-puppet-1/modules-0 on /tmp/vagrant-puppet-1/modules-0 type vboxsf (gid=500,rw)
[vagrant@vagrant-centos63 ~]$ cd /tmp/va
vagrant-puppet-1/ validation.sh     
[vagrant@vagrant-centos63 ~]$ cd /tmp/vagrant-puppet-1/manifests/
[vagrant@vagrant-centos63 manifests]$ FACTER_is_vagrant='true' puppet apply --hiera_config hiera.yaml --modulepath '/tmp/vagrant-puppet-1/modules-0' /tmp/vagrant-puppet/manifests/default.pp
Error: Could not run: Could not find file /tmp/vagrant-puppet/manifests/default.pp
[vagrant@vagrant-centos63 manifests]$ FACTER_is_vagrant='true' puppet apply --hiera_config hiera.yaml --modulepath '/tmp/vagrant-puppet-1/modules-0' /tmp/vagrant-puppet-1/manifests/default.pp 
Notice: role::ui configured for vagrant; hostname: 192.168.42.42
Notice: /Stage[main]/Role::Ui/Notify[role::ui::notify]/message: defined 'message' as 'role::ui configured for vagrant; hostname: 192.168.42.42'
Notice: Finished catalog run in 0.02 seconds
[vagrant@vagrant-centos63 manifests]$ 

I'm on vagrant 1.4.3.

ChastinaLi commented 7 years ago

:+1: