FreddieB
2010-Sep-13 13:20 UTC
[Puppet Users] Puppet trying to start service before package is installed
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'' 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", } ##################### ### Start service ### ##################### service { zabbix-agent : name => $operatingsystem ? { freebsd => ''zabbix_agentd'', #debian => [""], #default => [""], }, require => Package[''zabbix-agent''], ensure => running, enable => true, } } ------------------------------------------------------------------------ Does anyone have a clue why it''s behaving this way? Best regards, Freddie -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Silviu Paragina
2010-Sep-13 15:50 UTC
Re: [Puppet Users] Puppet trying to start service before package is installed
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-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Kris Saxton
2010-Oct-21 13:46 UTC
[Puppet Users] Re: Puppet trying to start service before package is installed
Hi Freddie, I experienced something similar with the init service provider (which the freebsd provider inherits). In some cases, the puppet agent seems to attempt to locate the init script before it''s been installed and throws the exception you''re seeing (''Could not find init script'') when it fails. So, it may be a resource ordering issue but I was able to work around the problem explicitly specifying the ''hasstatus'' and ''status'' parameters. So, something like: service{ zabbix-agent : name => "zabbix_agentd", require => Package[''zabbix-agent''], ensure => running, hasstatus => true, status => "/path/to/init/script status", } I had similar issues with ''enable'' so you might try removing that while you test. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.