Ask Your Question
0

Dependency Package[apache] has failures: true

asked 2014-04-24 10:24:14 -0500

fanttazio gravatar image

updated 2014-04-24 10:48:05 -0500

Hi,

I'm trying to do exercises on the Puppet website. I have written a class for Apache server but upon compiling the code I get this error:

Notice: /Stage[main]/Apache/File[apache.conf]: Dependency Package[apache] has failures: true Warning: /Stage[main]/Apache/File[apache.conf]: Skipping because of failed dependencies Notice: /Stage[main]/Apache/Service[apache]: Dependency Package[apache] has failures: true Warning: /Stage[main]/Apache/Service[apache]: Skipping because of failed dependencies

the code is:

class apache {
   case $operatingsystem {
        centos, redhat : {
            $service_name   = 'httpd'
            $config_file    = 'httpd.conf'
            $config_path    = '/etc/httpd/conf'
        }

        debian, ubuntu : {
            $service_name   = 'httpd'
            $config_file    = 'httpd.conf'
            $config_path    = '/etc/apache2/'
        }
    }

    package { 'apache':
        ensure => installed,

    }

    file { 'apache.conf':
        path     => "${config_path}/${config_file}",
        ensure   => file,
        require => Package['apache'],
        source   => "puppet:///modules/apache/files/${config_file}",
    }

    service {'apache':
        name      => $service_name,
        ensure    => running,
        enable    => true,
        subscribe => File['apache.conf'],

    }

what am I doing wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-04-24 10:50:32 -0500

That is because puppet didn't find the package called apache , because on distro based on redhat

the name is httpd and for distro based on debian is apache2, try use your case to do that.

class apache {

    case $operatingsystem {
        centos, redhat : {
            $package_name = 'httpd'
            $service_name   = 'httpd'
            $config_file    = 'httpd.conf'
            $config_path    = '/etc/httpd/conf'
        }

        debian, ubuntu : {
            $package_name = 'apache2'
            $service_name   = 'apache2'
            $config_file    = 'apache2.conf'
            $config_path    = '/etc/apache2/'
        }
    }

    package { $package_name:
        ensure => installed,

    }
edit flag offensive delete link more

Comments

I was assuming Puppet can fetch known packages itself.

fanttazio gravatar imagefanttazio ( 2014-04-24 11:18:06 -0500 )edit
1

It can, but the packages have different names on different linux distributions.

lavaman gravatar imagelavaman ( 2014-04-24 11:39:42 -0500 )edit

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-04-24 10:24:14 -0500

Seen: 3,185 times

Last updated: Apr 24 '14