2

I am creating a "site module" to manage multiple VM.

I used this project as a template : https://github.com/nvalentine-puppetlabs/puppet-site which is based on a convention described by Craig Dunn at: http://www.craigdunn.org/2012/05/239/

I am using Puppet 3.4.3 (Puppet Enterprise 3.2.1).

I modified the role class to include the base profile.

class site::role inherits site::role::params {
  require site
  notify { "site::role": }
  include site::profile::base
}

class site::profile::base inherits site::profile::base::params {
  require site::profile
  notify { "site::profile::base": }
    include site::users

      package { [
        'htop',
        'rsync',
        'openssl',
        'man',
        'wget',
        'nano',
        'lsb-release',
      'tree' ]:
        ensure => present,
      }
}

I have added the class site::role::www to my nodes.

Everything so far worked fine. All the packages were installed.

I then tried to create a www role and a webserver profile.

class site::role::www inherits site::role::www::params {
  require site::role
  notify { "site::role::www": }
  # perhaps all nodes at your site use this as a base?
  include site::profile::webserver
}

class site::profile::webserver inherits site::profile::webserver::params {
  require site::profile
  notify { "site::profile::webserver": }

  file { "/home/httpd/":
      ensure => "directory",
  }
  ->
  class { 'apache': 
     serveradmin   => 'dev@domain.com',
     server_tokens => 'Prod'
  }
  ->
  apache::vhost { "$ipaddress":
    port          => '80',
    docroot       => '/home/httpd/exploit',
  }

  include apache::mod::php

}

But none of the modifications declared in the webserver profile are taken into account...

Structure of the module:

site/
|-- LICENSE
|-- Modulefile
|-- README.md
|-- manifests
|   |-- init.pp
|   |-- params.pp
|   |-- profile
|   |   |-- base
|   |   |   `-- params.pp
|   |   |-- base.pp
|   |   |-- params.pp
|   |   |-- webserver
|   |   |   `-- params.pp
|   |   `-- webserver.pp
|   |-- profile.pp
|   |-- role
|   |   |-- params.pp
|   |   |-- www
|   |   |   `-- params.pp
|   |   `-- www.pp
|   |-- role.pp
|   `-- users.pp
|-- metadata.json
`-- tests
    |-- init.pp
    |-- site_profile.pp
    |-- site_profile_base.pp
    `-- site_role.pp

Content of classes.txt on agent nodes:

root@****:/var/opt/lib/pe-puppet# cat classes.txt
pe_mcollective
site::role::www
settings
default
pe_mcollective
pe_mcollective::params
pe_mcollective::role::agent
pe_mcollective::server
pe_mcollective::server::plugins
pe_mcollective::shared_key_files
site::role::www::params
site::params
site::role::params
site::role::www
site::role
site
site::profile::base::params
site::profile::params
site::profile::base
site::profile
site::users
null
  • 3,959
  • 1
  • 21
  • 28
  • 1
    so have you included site::profile::webserver? – Lodewijk Bogaards May 01 '14 at 08:48
  • Line 5 of the www class. – null May 02 '14 at 08:32
  • 1
    On the agent nodes, can you check the `$vardir/state/classes.txt` file? (Perhaps share an example?) – Felix Frank May 03 '14 at 18:33
  • I have added the content of classes.txt and `site::profile::webserver` is not in this file but there is `site::role::www` and `site::profile::webserver` is included in `site::role::www` ... – null May 05 '14 at 07:35
  • 1
    You could try and restart your master services. You can also enable debug logging on the master, see if that yields anything. Although I fear that there may not be much to go by. My gut tells me it's some hard to trace error like the master not reading the `site::role::www` class you think it does, because there is a different definition in another location or somesuch. As a last ditch debugging effort, you can sprinkle the code with calls to the `warning` function to do printf-debugging inside the master log. – Felix Frank May 05 '14 at 07:52

0 Answers0