Ask Your Question
0

Error: Could not find dependent Service[httpd]

asked 2014-10-22 08:31:44 -0500

shaun666 gravatar image

Hi,

I'm using the latest PE training vm and I get the above error when I attempt to apply my apache class

I've defined the service in params.pp as httpd for RedHat.

TIA in putting me right

Shaun

apache/manifests/init.pp:

class apache ( $httpduser = $apache::params::httpduser, $httpdgroup = $apache::params::httpdgroup, $httpdpkg = $apache::params::httpdpkg, $httpdsvc = $apache::params::httpdsvc, $httpdconf = $apache::params::httpdconf, $httpdconfdir = $apache::params::httpdconfdir, $httpddocroot = $apache::params::httpddocroot, $httpdconfdotd = $apache::params::httpdconfdotd, ) inherits apache::params {

File { owner => $httpduser, group => $httpdgroup, mode => '0644', }

package { $httpd_pkg: ensure => installed, }

file { $httpdconf: ensure => file, path => "${httpdconfdir}/${httpdconf}", owner => 'root', group => 'root', source => "puppet:///modules/apache/${httpdconf}", require => Package[$httpd_pkg], }

service { $httpsvc: ensure => running, subscribe => File[$httpdconf],
}

apache::vhost { $::fqdn: docroot => $httpd_docroot, } }

apache/manifests/params.pp:

class apache::params { case $::osfamily { 'RedHat': { $httpduser = 'apache' $httpdgroup = 'apache' $httpdpkg = 'httpd' $httpdsvc = 'httpd' $httpdconf = 'httpd.conf' $httpdconfdir = '/etc/httpd/conf' $httpdconfdotd = '/etc/httpd/conf.d' } 'Debian': { $httpduser = 'www-data' $httpdgroup = 'www-data' $httpdpkg = 'apache2' $httpdsvc = 'apache2' $httpdconf = 'apache2.conf' $httpdconfdir = '/etc/apache2' $httpdconfdotd = '/etc/apache2/sites-enabled' } default: { fail("Module ${module_name} is not supported on $::osfamily") } } }

apache/manifests/vhost.pp:

define apache::vhost ( $port = '80', $docowner = $apache::httpduser, $docgroup = $apache::httpdgroup,
$confdir = $apache::httpdconfdotd, $priority = '10', $options = 'Indexes Multiviews', $vhostname = $title, $servername = $title, $docroot = "${apache::httpddocroot/$title}", ) { host { $servername: ip => $::ipaddress, } File { owner => $docowner, group => $docgroup, mode => '0644', } file { "$confdir/${priority}-${title}.conf": ensure => file, notify => Service[$apache::httpdsvc], content => template('apache/vhost.conf.erb'), require => Package[$apache::httpd_pkg], } file { $docroot: ensure => directory, }

file { "${docroot}/index.html": # Use content with templates NOT source ensure => file, content => template("apache/index.html.erb"), }

}

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-10-22 11:46:24 -0500

shaun666 gravatar image

I've figured this out but I'm unable to post the corrected code, as I am unable to format it correctly....

Sorry

Shaun

I'd be grateful the moderator would simply delete my post

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-10-22 08:31:44 -0500

Seen: 836 times

Last updated: Oct 22 '14