Brian D
Brian D

Reputation: 2110

puppet looking for hiera.yaml in the wrong place

I want puppet to look for hiera.yaml in /etc but it's looking for it in /etc/puppet. I put a line into puppet.conf:

hiera_config = /etc/hiera.yaml

But still gives me the hiera.yaml update warning when I run the script.

I'm running the script from Vagrant 1.2.2. Using puppet 3.2.2

I'm running Centos 6.4 in a vm.

Upvotes: 4

Views: 4765

Answers (3)

Marcus Philip
Marcus Philip

Reputation: 500

Puppet provisioning runs as root user, not vagrant, so that's why it doesn't take notice of your puppet.conf in /vagrant.

If you run puppet config print inside the vm from user vagrant and root you see ALL puppet config settings per user and compare.

Upvotes: 1

ivanlei
ivanlei

Reputation: 116

I found that the puppet provisioner in vagrant now support hiera_config_path which does exactly what is desired.

config.vm.provision :puppet do |puppet|
  # path on host machine to hiera.yaml
  puppet.hiera_config_path = '/Users/me/vms/hiera/hiera.yaml'
  # This sets the relative path for hiera data directories
  puppet.working_directory = '/Users/me/vms/hiera'
end

This is documented in Vagrant: Up and Running but I didn't find it until I started looking into the vagrant source to implement this feature myself.

Upvotes: 8

choover
choover

Reputation: 852

Hmmm... On Vagrant 1.2.2 and Puppet 3.2.3, I am able to set hiera_config in puppet.conf without problems. I would double-check that you are editing /etc/puppet.conf on the Vagrant vm, not on the host machine, and that the hiera_config line is the [main] block, not just in the [master] block.

If both of those conditions are true and it is still not working, you might try explicitly setting hiera_config in your Vagrantfile:

config.vm.provision :puppet do |puppet|
  ...
  puppet.options = '--hiera_config=/etc/hiera.yaml'
end

Good luck!

Upvotes: 2

Related Questions