0

I'm an absolute beginner at Puppet, and I'm having an issue when I try to install a package via the apt-module.

class newrelic {
        apt::source {
                'newrelic':location => 'http://apt.newrelic.com/debian/',
                repos => 'non-free',
                key => '548C16BF',
                key_source => 'https://download.newrelic.com/548C16BF.gpg',
                include_src => false,
                release => 'newrelic',
        }
        package {
                'newrelic-sysmond':ensure => 'present',
                notify => Service['newrelic-sysmond'],
                require => Class['apt::source'],
        }
        service {
                'newrelic-sysmond':ensure => 'running',
                enable => true,
                hasrestart => true,
                hasstatus => true,
                require => Exec['newrelic_config'],
        }
        exec {
                'newrelic_config':path => '/bin:/usr/bin',
                command => "/usr/sbin/nrsysmond-config --set license_key=xxxxxxx",
                user => 'root',
                group => 'root',
                require => Package['newrelic-sysmond'],
                notify => Service['newrelic-sysmond'],
        }
}

This is the error I receive:

Warning: Scope(Class[Apt::Update]): Could not look up qualified variable '::apt::always_apt_update'; class ::apt has not been evaluated
Warning: Scope(Class[Apt::Update]): Could not look up qualified variable 'apt::update_timeout'; class apt has not been evaluated
Warning: Scope(Class[Apt::Update]): Could not look up qualified variable 'apt::update_tries'; class apt has not been evaluated
Notice: Compiled catalog for host.domain.local in environment production in 0.33 seconds
Error: Could not find dependency Class[Apt::Source] for Package[newrelic-sysmond] at /home/jeroen/puppet/modules/newrelic/manifests/init.pp:16

Any idea what I'm doing wrong in my module?

  • Eyeballing it, once this is fixed I'm not sure if you'll get dependency cycle problems or not. You might do, OTTOMH I'm not certain! – shearn89 Feb 26 '15 at 12:43
3

You need to add include apt at the top of your class, before the apt::source declaration: the error is saying it can't find apt::things because it doesn't know what the higher scope apt is.

The include apt will use various defaults, if you want to change them you'll need to instead use a declaration such as:

class { 'apt':
    always_apt_update => true,
}

...for example. More info on the forge page.

Also, your require is wrong: you need to specify the name as well, so I think it should be Apt::Source['newrelic'] instead of Class['apt::source'].

  • Thanks, but this doesn't resolve the dependency issue. How do I instruct Puppet that the package depends on the configuration of the repository? – Jeroen Jacobs Feb 26 '15 at 12:47
  • Maybe you should post that last reply as an answer, so I can mark it as the answer. – Jeroen Jacobs Feb 26 '15 at 13:50
  • @JeroenJacobs - done, I've updated this one and deleted the comment! – shearn89 Feb 26 '15 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.