Re: [Puppet Users] Issue copying files if package exists

2016-06-17 Thread Helmut Schneider
Rob Nelson wrote: > Modeling state can be tricky. It's pretty easy for a human to > understand conditionals like "If a package is installed, install a > file," but for state modeling, resources are best defined as either > managed or unmanaged, not somewhere in between. It's important to > keep

Re: [Puppet Users] Issue copying files if package exists

2016-06-13 Thread Rob Nelson
I think it's important to note that CMs like Puppet only manage what you tell it to manage via your state description. "If openssh-server is installed" doesn't fit that model well because it has a conditional state based on a potentially unmanaged component. "I want to manage the package

Re: [Puppet Users] Issue copying files if package exists

2016-06-13 Thread Helmut Schneider
Craig Dunn wrote: > Given the above, what are you trying to achieve? Are you trying to > manage the file resource after the package resource, or are you > saying you only want to manage the file if the package exists on the > target system? The latter. If openssh-server is installed, copy the

Re: [Puppet Users] Issue copying files if package exists

2016-06-13 Thread Craig Dunn
>From reading your comments I think maybe you are misunderstanding what the defined() function does. This function is run *server side* during the compilation of the catalog and is saying "If this Puppet resource exists in the catalog, yet". It is not saying "If this resource is configured on

Re: [Puppet Users] Issue copying files if package exists

2016-06-12 Thread Helmut Schneider
Rob Nelson wrote: > Your code only shows one package, $package, being created, but it > does not show where the value for $package is set. Either that var The package block is missleading, it just installs fail2ban: $package = $::operatingsystem ? { /(?i:Ubuntu|Debian|Mint)/ =>

Re: [Puppet Users] Issue copying files if package exists

2016-06-12 Thread Rob Nelson
Your code only shows one package, $package, being created, but it does not show where the value for $package is set. Either that var has the value 'postfix', or the postfix package is managed in another file. Regardless, there is nothing showing where a package called $sshdPackage is managed here,

[Puppet Users] Issue copying files if package exists

2016-06-12 Thread Helmut Schneider
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 =>