Ask Your Question
0

Cannot find HOME when running manifest

asked 2016-10-13 01:41:59 -0500

menigma gravatar image

Hello, newcomer in Puppet. I am trying to fiddle with a box that i created using vagrant. I have used the ubuntu/xenial64 box and installed puppet-agent via the

wget https://apt.puppetlabs.com/puppetlabs-release-pc1-wheezy.deb
dpkg -i puppetlabs-release-pc1-wheezy.deb
apt-get update && apt-get install puppet-agent

now i find myself unable to run this manifest to install a module:

Puppet script taken from this stackoverflow: http://stackoverflow.com/questions/16...

$module_vcsrepo = 'puppetlabs-vcsrepo'
  exec { 'puppet_module_vcsrepo':
    command => "puppet module install ${module_vcsrepo}",
    unless  => "puppet module list | grep ${module_vcsrepo}",
    path    => ['/home/ubuntu/','/bin', '/opt/puppetlabs/bin']
  }

Puppet script console output

Notice: Compiled catalog for ubuntu-xenial.localdomain in environment production in 0.18 seconds
Notice: /Stage[main]/Main/Exec[puppet_module_vcsrepo]/returns: Error: Could not initialize global default settings: couldn't find HOME       environment -- expanding `~'
Error: puppet module install puppetlabs-vcsrepo returned 1 instead of one of [0]
Error: /Stage[main]/Main/Exec[puppet_module_vcsrepo]/returns: change from notrun to 0 failed: puppet module install puppetlabs-vcsrepo    returned 1 instead of one of [0]
Notice: Applied catalog in 1.89 seconds

I have checked my HOME variable, it is set to /home/ubuntu

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-10-13 15:26:13 -0500

lupin gravatar image

you can pass the environment parameter to it and set the path where it can find the command binary.

$module_vcsrepo = 'puppetlabs-vcsrepo'
  exec { 'puppet_module_vcsrepo':
    command     => "puppet module install ${module_vcsrepo}",
    unless           => "puppet module list | grep ${module_vcsrepo}",
    path              => ['/home/ubuntu/bin','/bin', '/opt/puppetlabs/bin'],
   environment => [ 'HOME=/home/ubuntu'],
  }
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-10-13 01:41:59 -0500

Seen: 91 times

Last updated: Oct 13 '16