Ben Ford wrote:

> To be sure, this pattern doesn't always work and you don't always have
> control over the full system. What's your use case that you're trying
> to solve?

if $operatingsystem == "Ubuntu" {
  if versioncmp($facts['os']['release']['full'], '18') >= 0 {
    file { "/etc/netplan/windows-dhcp.yaml":
      mode    => '0644',
      owner   => "${rootUID}",
      group   => "${rootGID}",
      content =>
epp("${module_name}/etc/netplan/windows-dhcp.yaml.epp"),
    }
  }
}

I would like to check if netplan is installed before doing so.

onlyif => 'test -d /etc/netplan',

would help. Or

onlyif => 'test -n "`dpkg -l | grep netplan | grep ^ii`"',

but I thought a custom fact would be more efficient.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/xn0ltyu254zxcub000%40news.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to