Search code examples
puppet

Puppet can't copy a file from a module


I try to copy a file from a module :

#init.pp
file { '/home/michael/projets/test_puppet/LICENSE':
        source  => 'puppet:///modules/java/LICENSE',
        replace => false,
}

But when I run puppet apply

puppet apply --modulepath=/home/michael/projets/test_puppet/modules/  manifests/init.pp

I get this error

Error: /Stage[main]/Main/File[/home/michael/projets/test_puppet/LICENSE]: 
Could not evaluate: Could not retrieve information from environment production 
source(s) puppet:///modules/java/LICENSE

My directory structure

.
├── manifests
│   └── init.pp
└── modules
    ├── java
    └── stdlib

Solution

  • with this path puppet:///modules/java/LICENSE, the file should be under

    /home/michael/projets/test_puppet/modules/java/files/LICENSE
    

    Could you please confirm if you have the file LICENSE in above path.

    Please go through the docs The Puppet File Server, it will help you to understand how it works.