I can confirm Russels conclusion that it is a bug and if you don't use "name => $operatingsystem..." is works. In my case I need to be able to distinguish between FreeBSD and Debian. A workaround that's working for me is to set the variables outside the "package"-statement like this:
------------------------------------------------------------------------------------- #################### ### zabbix agent ### #################### class zabbix-agent { case $operatingsystem { freebsd: { $pkg_name = 'zabbix-agent' $service_name = 'zabbix_agentd' $cfg_file = '/usr/local/etc/zabbix/ zabbix_agentd.conf' } debian: { $pkg_name = 'zabbix-agent' $service_name = 'zabbix_agent' $cfg_file = '/etc/zabbix/zabbix_agentd.conf' } default: { $pkg_name = 'zabbix-agent' $service_name = 'zabbix_agent' $cfg_file = '/etc/zabbix/zabbix_agentd.conf' } } Package[$pkg_name] -> File[$cfg_file] -> Service[$service_name] ####################### ### Install package ### ####################### package { $pkg_name : ensure => installed, } ####################### ### Get config-file ### ####################### file { $cfg_file : ensure => file, checksum => md5, owner => 'root', group => $operatingsystem ? { freebsd => 'wheel', debian => 'root', default => 'wheel', }, mode => 644, require => Package[$pkg_name], source => "puppet:///modules/zabbix-agent/$hostname/ zabbix_agentd.conf", } ##################### ### Start service ### ##################### service { $service_name : require => Package[$pkg_name], ensure => running, enable => true, } } ---------------------------------------------------------------------------------- Thanks for all your help. /Freddie On Sep 13, 6:59 pm, Russell Jackson <r...@csub.edu> wrote: > On 09/12/2010 07:32 AM, FreddieB wrote: > > > > > I looks like Puppet is not able to figure out that MySQL 5.1 is > > already installed. If I list the packages installed (with pkg_info) I > > find MySQL there but it's not called "mysql51-server" but "mysql- > > server-5.1.48". If I go back to my init.pp and change the name from > > "mysql51-server" to just "mysql-server", it works again (i.e. it will > > not try to install the package again). It is not possible to start > > with just "mysql-server", because there is no package called just > > "mysql-server". > > > My conclusion is that FreeBSD's inconsistent way of naming the > > packages fools Puppet to think it's not installed. I've never written > > a line of ruby-code so I could use some help here. Can anyone think of > > a good workaround? > > > BTW - my current, and not so pretty workaround is to link mysql- > > server.tbz to mysql51-server.tbz on my local FreeBSD-mirror-site. > > Yes. The package system has turned out to be a royal PITA for puppet. I > don't have any good work-a-rounds at the moment. I think we might be > able to do something by specifying the package name as the port origin > (pkg_info -o) and looking up the right package out of ports/INDEX. > > There's been some discussion on the freebsd-ports list about improving > the pkg_* tools and ports in general. I'm tempted to just say use APT > and call it good. There's zero chance of that happening due to licensing. > > -- > Russell A Jackson <r...@csub.edu> > Network Analyst > California State University, Bakersfield -- 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.