On 13.09.2010 16:20, FreddieB wrote:
Hi,
This one is driving me crazy. Problem is Puppet try to start some
services (in this case zabbix-agent) before it is installed.

My puppet-master is Debian 5.05 with Puppet 2.6.0 (from squeeze).
Target system is FreeBSD 8.1 with Puppet 2.6.1 (from packages-8-
stable).

When I run puppet manually in debug-mode I get:
MASTER:
debug: Adding relationship from Package[zabbix-agent] to File[zabbix-
agent_conf] with 'before'
debug: Adding relationship from File[zabbix-agent_conf] to
Service[zabbix-agent] with 'before'

AGENT:
debug: Puppet::Type::Package::ProviderFreebsd: Executing '/usr/sbin/
pkg_info'
debug: Service[zabbix-agent](provider=freebsd): Could not find
zabbix_agentd in /etc/rc.d
debug: Service[zabbix-agent](provider=freebsd): Could not find
zabbix_agentd in /usr/local/etc/rc.d
debug: Service[zabbix-agent](provider=freebsd): Could not find
zabbix_agentd.sh in /etc/rc.d
debug: Service[zabbix-agent](provider=freebsd): Could not find
zabbix_agentd.sh in /usr/local/etc/rc.d
err: Could not run Puppet configuration client: Could not find init
script for 'zabbix_agentd'

1. try to restart both puppetd (client) and puppetmaster (server)
- just to be safe the error is not from a cache entry (though it shouldn't happen like this) 2. if that didn't work, this might be a bug in the freebsd service provider, then you should probably open a bug report

Make sure you do a fgrep "Service[zabbix-agent]" on the log file. The provider might just be informing you that at startup the service isn't there, and run after.

My modules init.pp-file looks like this (Debian-stuff is commented out
for troubleshooting):
-----------------------------------------------------------------------------
####################
### zabbix agent ###
####################

class zabbix-agent {
    Package['zabbix-agent'] ->  File['zabbix-agent_conf'] ->
Service['zabbix-agent']

    #######################
    ### Install package ###
    #######################
    package { zabbix-agent :
       name   =>  $operatingsystem ? {
          freebsd =>  'zabbix-agent',
          #debian  =>  '',
          #default =>  '',
       },
       alias  =>  "zabbix-agent",
       ensure =>  installed,
    }


    #######################
    ### Get config-file ###
    #######################
    file { 'zabbix-agent_conf' :
       path    =>  $operatingsystem ? {
          freebsd =>  "/usr/local/etc/zabbix/zabbix_agentd.conf",
          #debian  =>  "/etc/zabbix/zabbix_agentd.conf",
          #default =>  "/usr/local/etc/zabbix/zabbix_agentd.conf",
       },
       ensure   =>  file,
       checksum =>  md5,
       owner    =>  'root',
       group    =>  $operatingsystem ? {
          freebsd =>  'wheel',
          debian  =>  'root',
          default =>  'wheel',
       },
       mode     =>  644,
       require  =>  Package['zabbix-agent'],
       source   =>  "puppet://10.10.10.10/modules/zabbix-agent/$hostname/
zabbix_agentd.conf",
Since you are a beginner, it might be useful to know that you can use "puppet:///modules/zabbix-agent/$hostname/", if you don't already know that.


    }

    #####################
    ### Start service ###
    #####################
    service { zabbix-agent :
       name    =>  $operatingsystem ? {
          freebsd =>  'zabbix_agentd',
          #debian  =>  [""],
          #default =>  [""],
       },
       require =>  Package['zabbix-agent'],
       ensure  =>  running,
       enable  =>  true,
     }
}

Readability suggestion: move your parameters outside the file to a zabbix-agent::params class. Take a look at the puppet labs apache module on puppet forge for an example.

Good luck, ;)
Silviu

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to