Puppet file link doesn’t create target under Windows

puppet

file {'VaultUsersLink':
      path => "C:/VaultWorkspace/VaultUsers.lnk",
      require => File['VaultWorkspace'],
      ensure => link,
      target => "C:/ProgramData/PuppetLabs/facter/facts.d/inventorusers.txt",
      owner => 'SYSTEM',
      group => 'Users',
      mode => 0776,
      }

Seems like it should make a shortcut, and it does make a 0 byte file named VaultUsers.lnk, but doesn't fill in the target. Am I missing something?

Best Answer

A link is not a Windows shortcut. A link is symbolic link. http://en.wikipedia.org/wiki/Symbolic_link. Does the file inventorusers.txt also have zero bytes?

link will make sure the file is a symlink, and requires that you also set the target attribute. Symlinks are supported on all Posix systems and on Windows Vista / 2008 and higher. On Windows, managing symlinks requires puppet agent’s user account to have the “Create Symbolic Links” privilege; this can be configured in the “User Rights Assignment” section in the Windows policy editor. By default, puppet agent runs as the Administrator account, which does have this privilege.

Related Topic