简体   繁体   中英

Puppet fileserver - Could not evaluate

I am working on trying to copying files from my puppetmaster to my webserver, which is not working.

On my puppetmaster I have edited the file fileserver.conf and added:

  [extra_files]
  path /etc/puppet/files
   allow *

After that, restarted puppetmaster and puppet on the puppetmaster.

I have an test.txt in the /etc/puppet/files folder

On the webserver I have this apache2.pp script

file { "/test.txt":
                 mode => "600",
                owner => 'root',
                group => 'root',
                ensure => present,
                source => "puppet:///files/test.txt",
        }

I am receiving this error, which I am really unsure how to solve:

 **Error: /Stage[main]/Main/File[/test.txt]: Could not evaluate: Could not retrieve information from environment production source(s)** 

Hope someone can maybe help me with some steps to troubleshoot what is going wrong.

According to description in fileserver.conf :

# [extra_files]
#   path /etc/puppet/files
#   allow *
#
# In the example above, anything in /etc/puppet/files/<file name> would be
# available to authenticated nodes at puppet:///extra_files/<file name>.
#

change

source => "puppet:///files/test.txt",

to

source => "puppet:///extra_files/test.txt",

Don't use file server mounts unless you have a very good reason to do so.

Instead, create a module that holds the file you need to sync, such as module webserver

mkdir -p /etc/puppet/modules/webserver/files

In your file resource, reference the file as follows:

source => 'puppet:///modules/webserver/test.txt'

Be careful not to include files in the URL of files that are retrieved from within modules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM