view modules/my_fw/manifests/init.pp @ 441:2474a711dfc5

Force WSGI for Python3 on Ubuntu
author IBBoard <dev@ibboard.co.uk>
date Sun, 14 Aug 2022 11:57:06 +0100
parents 66c406eec60d
children 2c3e745be8d2
line wrap: on
line source

class my_fw ($ip_version) {
  $real_ensure_v4 = $ip_version == "IPv6" ? { true => 'stopped', default => 'running'}
  $real_ensure_v6 = $ip_version == "IPv6" ? { true => 'running', default => 'stopped'}
  case $::operatingsystem {
    'CentOS': {
      $ensure_v4 = $real_ensure_v4
      $ensure_v6 = $real_ensure_v6
    }
    # Ubuntu doesn't understand IPv4 vs IPv6
    'Ubuntu': {
      $ensure_v4 = ($real_ensure_v4 == 'running' or $real_ensure_v6 == 'running') ? { true => 'running', default => 'stopped' }
      $ensure_v6 = undef
    }
  }
  Firewall <| |> {
    provider => $ip_version == "IPv6" ? { true => 'ip6tables', default => 'iptables'},
  }
  class { ['my_fw::pre', 'my_fw::post']: }
  class { 'firewall':
    ensure => $ensure_v4,
    ensure_v6 => $ensure_v6,
  }
}