0

Host is Windows 8 I prepared a shell script which execute secure_mysql_installation This is the folders structure

c:\myproject\
      Vagranfile
      puppet\
          files\
             secure_mysql.sh
          mainfests\
             init.pp

This is my puppet code to copy the local host shell script to vagrant box

    class secure_mysql_installation {
        file { '/tmp/secure_mysql.sh':
                source => 'puppet:///files/secure_mysql.sh',
                ensure => present,
               }
     }

When vagrant up, it gave me an error ==> default: Error: /Stage[main]/Secure_mysql_installation/File[/tmp/secure_mysq l.sh]: Could not evaluate: Cannot find file: Invalid mount 'secure_mysql.sh' Cou ld not retrieve file metadata for puppet:///files/secure_mysql.sh: Cannot find file: I nvalid mount 'secure_mysql.sh'

Adrian
  • 45
  • 1
  • 2
  • 6

2 Answers2

2

On the guest, that folder is going to be at /vagrant/puppet/files, but you don't want to use that at all since it doesn't translate from vagrant to everywhere else. The answer by @deagh starts to lead you in the right direction. You need to move any files into a modules folder.

So

c:\myproject\
      Vagranfile
      puppet\
          modules\
             mymodulename\
               files\
                 secure_mysql.sh
          mainfests\
             init.pp

And then you can reach it with

 class secure_mysql_installation {
    file { '/tmp/secure_mysql.sh':
            source => 'puppet:///modules/mymodulename/secure_mysql.sh',
            ensure => present,
           }
 }

For more information about file serving and mount points, please see https://docs.puppetlabs.com/guides/file_serving.html

ferventcoder
  • 347
  • 3
  • 4
  • 12
0

Your source definition lacks the module name try

source => 'puppet:///modules/[MODULENAME]/secure_mysql.sh',

deagh
  • 2,019
  • 5
  • 19
  • 19
  • While this is technically the right answer, you may need to state that files should be under a module folder. – ferventcoder Sep 27 '14 at 17:45
  • Yes and to be even more precise i have to say that your file should be placed under '[MODULENAME]/files/' – deagh Sep 27 '14 at 17:51