Ask Your Question
1

Serving Module Files with Puppet OS/Vagrant

asked 2013-06-24 20:34:36 -0600

louis gravatar image

Hi,

I have the following class that needs to serve files from the specific module/file folder.

class webpicmd{

  file { 'tempdir':
    ensure => 'directory',
    name   => 'C:\Temp'
  }

  file { 'WebPiCmd':
    ensure  => present,
    name    => 'C:\Temp\WebPiCmd.exe',
    source  => '/webpicmd/WebPiCmd.exe',
    mode    => '0755',
    require => File['tempdir']
  }

  file { 'WebPiCmdDll':
    ensure  => present,
    name    => 'C:\Temp\Microsoft.Web.PlatformInstaller.dll',
    source  => 'puppet:///modules/webpicmd/Microsoft.Web.PlatformInstaller.dll',
    mode    => '0755',
    require => File['tempdir']
  }
}

This class works perfect using the classic client/server setup but when using Vagrant starts failing with the following error:

Error: /Stage[first]/Webpicmd/File[WebPiCmdDll]: Could not evaluate: Failed to get ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-06-25 04:56:42 -0600

updated 2013-06-25 05:12:36 -0600

The source parameter syntax in that sample you provided:

file { 'WebPiCmdDll':
  ...
  source  => 'puppet:///modules/webpicmd/Microsoft.Web.PlatformInstaller.dll',
  ...
}

Implies a network retrieval. You need a fully running puppet master to use this.

The vagrant puppet apply provisioner doesn't start such a network service.

One option is to start a puppet master on one of your nodes (instructions not supplied here) and use the puppet agent vagrant provisioner: http://docs.vagrantup.com/v2/provisioning/puppet_agent.html to point your agent at your running master.

Alternatively you could use a local path in your file resource instead:

file { "foo":
  source ...
(more)
edit flag offensive delete link more

Comments

I guess i need to set the puppet master first and then instance another puppet agent using vagrant.

louis gravatar imagelouis ( 2013-06-25 08:20:18 -0600 )edit
1

answered 2013-08-25 13:29:06 -0600

radeksimko gravatar image

You can setup a file server locally, create a fileserver.conf:

[files]
  path /tmp/vagrant-puppet/files
  allow *

and point the puppet provisioner to it in Vagrantfile (the path will be absolute within the VM, therefore you also need to share the Vagrant folder with the VM):

config.vm.synced_folder './', '/tmp/vagrant'
config.vm.provision :puppet do |puppet|
    puppet.options << '--fileserverconfig /tmp/vagrant/fileserver.conf'
end
edit flag offensive delete link more

Comments

The --fileserverconfig option worked for me. Thank you. Note: I first tried the --fsconfig options, which did not work, it is only applicable to the puppet master.

Farooq Sadiq gravatar imageFarooq Sadiq ( 2014-08-07 14:49:12 -0600 )edit

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: 2013-06-24 20:34:36 -0600

Seen: 2,463 times

Last updated: Aug 25 '13