Mercurial > repos > other > Puppet
comparison modules/firewall/manifests/init.pp @ 275:d9352a684e62
Mass update of modules to remove deprecation warnings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 26 Jan 2020 11:36:07 +0000 |
parents | d6f2a0ee45c0 |
children | 66c406eec60d |
comparison
equal
deleted
inserted
replaced
274:b2571c28fc27 | 275:d9352a684e62 |
---|---|
1 # = Class: firewall | 1 # @summary |
2 # Performs the basic setup tasks required for using the firewall resources. | |
2 # | 3 # |
3 # Manages packages and services required by the firewall type/provider. | 4 # At the moment this takes care of: |
4 # | 5 # |
5 # This class includes the appropriate sub-class for your operating system, | 6 # iptables-persistent package installation |
6 # where supported. | 7 # Include the firewall class for nodes that need to use the resources in this module: |
7 # | 8 # |
8 # == Parameters: | 9 # @example |
10 # class { 'firewall': } | |
9 # | 11 # |
10 # [*ensure*] | 12 # @param ensure |
11 # Ensure parameter passed onto Service[] resources. | 13 # Controls the state of the ipv4 iptables service on your system. Valid options: 'running' or 'stopped'. |
12 # Default: running | 14 # |
15 # @param ensure_v6 | |
16 # Controls the state of the ipv6 iptables service on your system. Valid options: 'running' or 'stopped'. | |
17 # | |
18 # @param pkg_ensure | |
19 # Controls the state of the iptables package on your system. Valid options: 'present' or 'latest'. | |
20 # | |
21 # @param service_name | |
22 # Specify the name of the IPv4 iptables service. | |
23 # | |
24 # @param service_name_v6 | |
25 # Specify the name of the IPv6 iptables service. | |
26 # | |
27 # @param package_name | |
28 # Specify the platform-specific package(s) to install. | |
29 # | |
30 # @param ebtables_manage | |
31 # Controls whether puppet manages the ebtables package or not. If managed, the package will use the value of pkg_ensure. | |
13 # | 32 # |
14 class firewall ( | 33 class firewall ( |
15 $ensure = running, | 34 $ensure = running, |
16 $service_name = $::firewall::params::service_name, | 35 $ensure_v6 = undef, |
17 $package_name = $::firewall::params::package_name, | 36 $pkg_ensure = present, |
37 $service_name = $::firewall::params::service_name, | |
38 $service_name_v6 = $::firewall::params::service_name_v6, | |
39 $package_name = $::firewall::params::package_name, | |
40 $ebtables_manage = false, | |
18 ) inherits ::firewall::params { | 41 ) inherits ::firewall::params { |
42 $_ensure_v6 = pick($ensure_v6, $ensure) | |
43 | |
19 case $ensure { | 44 case $ensure { |
20 /^(running|stopped)$/: { | 45 /^(running|stopped)$/: { |
21 # Do nothing. | 46 # Do nothing. |
22 } | 47 } |
23 default: { | 48 default: { |
24 fail("${title}: Ensure value '${ensure}' is not supported") | 49 fail("${title}: Ensure value '${ensure}' is not supported") |
25 } | 50 } |
26 } | 51 } |
27 | 52 |
53 if $ensure_v6 { | |
54 case $ensure_v6 { | |
55 /^(running|stopped)$/: { | |
56 # Do nothing. | |
57 } | |
58 default: { | |
59 fail("${title}: ensure_v6 value '${ensure_v6}' is not supported") | |
60 } | |
61 } | |
62 } | |
63 | |
28 case $::kernel { | 64 case $::kernel { |
29 'Linux': { | 65 'Linux': { |
30 class { "${title}::linux": | 66 class { "${title}::linux": |
31 ensure => $ensure, | 67 ensure => $ensure, |
32 service_name => $service_name, | 68 ensure_v6 => $_ensure_v6, |
33 package_name => $package_name, | 69 pkg_ensure => $pkg_ensure, |
70 service_name => $service_name, | |
71 service_name_v6 => $service_name_v6, | |
72 package_name => $package_name, | |
73 ebtables_manage => $ebtables_manage, | |
34 } | 74 } |
75 contain "${title}::linux" | |
76 } | |
77 'FreeBSD', 'windows': { | |
35 } | 78 } |
36 default: { | 79 default: { |
37 fail("${title}: Kernel '${::kernel}' is not currently supported") | 80 fail("${title}: Kernel '${::kernel}' is not currently supported") |
38 } | 81 } |
39 } | 82 } |