-1

1.when i used "puppet agent -t" command in agents it's not retrieving from puppet server and getting the error as below. 2.the below code i have used in modules path:/etc/puppetlabs/code/environments/production/modules/mailx/manifests/init.pp and i have included this class in site.pp file as below.

Error: 1.I

/Stage[main]/Mailx/File[/etc/mail.rc]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/mailx/mail.rc

file { '/etc/mail.rc':

ensure => present,

mode => '0644',

owner => 'root',

group => 'root',

source => 'puppet:///modules/mailx/mail.rc', }

node 'default', { include mailx }

1 Answers1

0

Your code will be much easier to read if you present it like this.

#/etc/puppetlabs/code/environments/production/modules/init.pp
class mailx {
  file { '/etc/mail.rc':
    ensure => present,
    mode   => '0644',
    owner  => 'root',
    group  => 'root',
    source => 'puppet:///modules/mailx/mail.rc',
  }
}

And then the file

#/etc/puppetlabs/code/environments/production/modules/mailx/files/mail.rc
set smtp=your.smtp.server
set from="from email address"

The module should be in /etc/puppetlabs/code/environments/production/modules/mailx/manifests/init.pp Notice the "production" after the environments. It may have just been a typo when you put the path in to here but you spelt puppetlabs as puppelabc.

And the file should be here /etc/puppetlabs/code/environments/production/modules/mailx/files/mail.rc

Each directory under the environment directory is an environment and that error says Puppet is looking in the production environment for that file.

16c7x
  • 500
  • 2
  • 6
  • Firstly thank you for your response, I have created all the modules under the environments only and the file location will be under the below path, path:/etc/puppetlabs/code/environments/production/modules/mailx/files/mail.rc I have followed same path as you mentioned above even i am getting same error – chennareddy Nov 17 '20 at 08:12
  • I've added a bit more to the example. It might be worth checking the fileserver.conf settings, details here https://puppet.com/docs/puppet/6.17/file_serving.html#creating-a-new-mount-point-in-fileserver.conf but if it's a default install it should be ok. – 16c7x Nov 18 '20 at 18:52