Hi, I want to copy files if a package is installed. What works fine with the packages 'postfix', 'fail2ban' and 'apache2' does not with 'openssh-server.
class fail2ban { $postfixPackage = $::operatingsystem ? { /(?i:Ubuntu|Debian|Mint)/ => 'postfix', default => 'undef', } $sshdPackage = $::operatingsystem ? { /(?i:Ubuntu|Debian|Mint)/ => 'openssh-server', default => 'undef', } if ! defined (Package["$package"]) { package { "$package": ensure => installed, } } if defined (Package["$postfixPackage"]) { file { "/etc/fail2ban/filter.d/postfix-amavis.local": mode => "0644", owner => 'root', group => 'root', source => 'puppet:///modules/fail2ban/etc/fail2ban/filter.d/postfix-amavis.local', } } if defined (Package["$sshdPackage"]) { file { "/etc/fail2ban/filter.d/sshd-dos.local": mode => "0644", owner => 'root', group => 'root', source => 'puppet:///modules/fail2ban/etc/fail2ban/filter.d/sshd-dos.local', } } } $ rm /etc/fail2ban/filter.d/postfix-amavis.local /etc/fail2ban/filter.d/sshd-dos.local^C $ sudo rm /etc/fail2ban/filter.d/postfix-amavis.local /etc/fail2ban/filter.d/sshd-dos.local $ sudo puppet agent -t -d | grep -Ei '(postfix|openssh-server|postfix-amavis.local|sshd-dos.local)' [...] Debug: /Package[postfix]: Provider apt does not support features virtual_packages; not managing attribute allow_virtual Debug: /Package[openssh-server]: Provider apt does not support features virtual_packages; not managing attribute allow_virtual [...] Notice: /Stage[main]/Fail2ban/File[/etc/fail2ban/filter.d/postfix-amavis.local]/ ensure: defined content as '{md5}c5def71abe5f682c2beb896fd5e30e10' Debug: /Stage[main]/Fail2ban/File[/etc/fail2ban/filter.d/postfix-amavis.local]: The container Class[Fail2ban] will propagate my refresh event So /etc/fail2ban/filter.d/sshd-dos.local is not copied. When uncommenting the if-clause 'if defined (Package["$sshdPackage"])' the file gets copied: $ sudo puppet agent -t -d | grep -i 'sshd-dos.local' Debug: /Stage[main]/Fail2ban/File[/etc/fail2ban/filter.d/sshd-dos.local]: Autorequiring File[/etc/fail2ban/filter.d/] Notice: /Stage[main]/Fail2ban/File[/etc/fail2ban/filter.d/sshd-dos.local]/ensure : defined content as '{md5}3d993678f322e5cb6335addaaa40512e' Debug: /Stage[main]/Fail2ban/File[/etc/fail2ban/filter.d/sshd-dos.local]: The container Class[Fail2ban] will propagate my refresh event Am I missing the obvious? $ puppet -V 3.8.7 $ lsb_release -d Description: Ubuntu 14.04.4 LTS Thank you -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/xn0k75zp1zhqvbs000%40news.gmane.org. For more options, visit https://groups.google.com/d/optout.