3
votes

I am trying to pull things out into roles and profiles and am having an issue. I am using puppet apply for all of this as I am using it to finish setting up my Puppet Master. If I define my node in site.pp as shown here:

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

I get 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 puppet apply directly it doesn'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 and how to fix it? As a side note, all three modules referenced here are hand written... none are Forge modules.

Update 1 Here is my puppet::install class:

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

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

2 Answers

1
votes

Somewhere in your manifest, you are declaring a File[/etc/puppet/hiera.yaml] that depends on Class[Puppet::Install], like

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

or so

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

or something in that vein.

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

include puppet::install # nice!

or

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

If in doubt, add the include line near the file declaration. It is usually safe to include a class multiple times.

0
votes

If you apply puppetmaster.pp directly, you're just defining the class not applying it.

You need to do puppet apply -e 'include ::roles::puppetmaster' to be comparible.

The other error is probably caused by modules/puppet/manifests/install.pp not existing, or the class definition in the file not starting with

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