Doll can't find addiction class

I am trying to figure out roles and profiles and I have a problem. I use a puppet for everyone because I use it to finish setting up my Puppet Master. If I define my node in site.pp like below:

[root@puppet puppetdbsetup]# cat manifests/site.pp
node 'puppet' {
  include ::roles::puppetmaster
}

      

I am getting this error:

[root@puppet puppetdbsetup]# puppet apply manifests/site.pp --environmentpath /etc/puppet/environments --environment puppetdbsetup --noop
Notice: Compiled catalog for puppet.belkin in environment puppetdbsetup in 1.29 seconds
Error: Could not find dependency Class[Puppet::Install] for File[/etc/puppet/hiera.yaml] at /etc/puppet/environments/puppetdbsetup/modules/p
uppet/manifests/master.pp:31

      

If I run puppetmaster.pp (shown below) with a puppet, apply it directly, it won't throw the same error.

[root@puppet puppetdbsetup]# cat modules/roles/manifests/puppetmaster.pp
class roles::puppetmaster {
  #include profiles::base
  include profiles::puppet::master
}

      

Can anyone tell me why this is the case and how to fix it? As a side note, all three modules mentioned here are written by hand ... none of them are Forge modules.

Update 1 Here is my doll :: install class:

[root@puppet puppetdbsetup]# cat modules/puppet/manifests/install.pp
class puppet::install {

  package { 'puppet':
    ensure   => present,
  }
}

      

+3


source to share


2 answers


Somewhere in your manifest, you declare File[/etc/puppet/hiera.yaml]

which depends on Class[Puppet::Install]

, for example

file { '/etc/puppet/hiera.yaml': require => Class['puppet::install'] }

      

or so

Class['puppet::install'] -> file { '/etc/puppet/hiera.yaml': ... }

      

or something like that.



What you are missing is the actual declaration of the class either via

include puppet::install # nice!

      

or

class { 'puppet::install': } # please don't

      

When in doubt, add an include line next to the declaration file

. It is usually safe to include a class multiple times.

+1


source


If you've applied puppetmaster.pp directly, you just define the class without applying it.

For comparison you need puppet apply -e 'include ::roles::puppetmaster'

.



Another error is probably caused by missing modules /puppet/manifestests/install.pp or class definition in file not starting with

class puppet::install (
    ....
    ....
) {

      

0


source







All Articles