Chris Taylor wrote:

> if $operatingsystem == "Ubuntu" { 
>   if versioncmp($facts['os']['release']['full'], '18') >= 0 { 
>     package { 'netplan':
>       ensure => present,
>     }
>     file { "/etc/netplan/windows-dhcp.yaml": 
>       mode    => '0644', 
>       owner   => "${rootUID}", 
>       group   => "${rootGID}", 
>       content => 
> epp("${module_name}/etc/netplan/windows-dhcp.yaml.epp"), 
>       requires => Package['netplan'],
>     } 
>   } 
> } 
> 
> If you only want netplan on specific systems, then you'd want that 
> delcaration to be done in such a way to only apply to said systems, I
> leave that as an exercise for the reader, as the mechanism that is
> best depends heavily upon your own setup.

I don't want to install netplan but if it exists do the needful:

  exec { 'test_for_netplan':
    path    => ['/usr/bin','/usr/sbin','/bin','/sbin'],
    command => "/bin/true",
    onlyif  => 'test -n "`dpkg -l | grep netplan | grep ^ii`"',
  }

  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"),
        require => Exec['test_for_netplan'],
      }
    }
  }

-- 
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/xn0lu0bwv6ju0fl000%40news.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to