|
32 | 32 | # @api private |
33 | 33 | # |
34 | 34 | class firewall::linux::redhat ( |
35 | | - $ensure = running, |
36 | | - $ensure_v6 = undef, |
37 | | - $enable = true, |
38 | | - $enable_v6 = undef, |
39 | | - $service_name = $firewall::params::service_name, |
40 | | - $service_name_v6 = $firewall::params::service_name_v6, |
41 | | - $package_name = $firewall::params::package_name, |
42 | | - $package_ensure = $firewall::params::package_ensure, |
43 | | - $sysconfig_manage = $firewall::params::sysconfig_manage, |
44 | | - $firewalld_manage = $firewall::params::firewalld_manage, |
45 | | -) inherits ::firewall::params { |
| 35 | + Enum[running, stopped, 'running', 'stopped'] $ensure = running, |
| 36 | + Optional[Enum[running, stopped, 'running', 'stopped']] $ensure_v6 = undef, |
| 37 | + Variant[Boolean, String[1]] $enable = true, |
| 38 | + Optional[Variant[Boolean, String[1]]] $enable_v6 = undef, |
| 39 | + Variant[String[1], Array[String[1]]] $service_name = $firewall::params::service_name, |
| 40 | + Optional[String[1]] $service_name_v6 = $firewall::params::service_name_v6, |
| 41 | + Optional[Variant[String[1], Array[String[1]]]] $package_name = $firewall::params::package_name, |
| 42 | + Enum[present, latest, 'present', 'latest'] $package_ensure = $firewall::params::package_ensure, |
| 43 | + Boolean $sysconfig_manage = $firewall::params::sysconfig_manage, |
| 44 | + Boolean $firewalld_manage = $firewall::params::firewalld_manage, |
| 45 | +) inherits firewall::params { |
46 | 46 | $_ensure_v6 = pick($ensure_v6, $ensure) |
47 | 47 | $_enable_v6 = pick($enable_v6, $enable) |
48 | 48 |
|
49 | 49 | # RHEL 7 / CentOS 7 and later and Fedora 15 and later require the iptables-services |
50 | 50 | # package, which provides the /usr/libexec/iptables/iptables.init used by |
51 | 51 | # lib/puppet/util/firewall.rb. |
52 | | - if ($::operatingsystem != 'Amazon') { |
| 52 | + if ($facts['os']['name'] != 'Amazon') { |
53 | 53 | if $firewalld_manage { |
54 | 54 | service { 'firewalld': |
55 | 55 | ensure => stopped, |
|
72 | 72 | ) |
73 | 73 | } |
74 | 74 |
|
75 | | - if ($::operatingsystem != 'Amazon') { |
| 75 | + if ($facts['os']['name'] != 'Amazon') { |
76 | 76 | if $ensure == 'running' { |
77 | 77 | $running_command = ['/usr/bin/systemctl', 'daemon-reload'] |
78 | 78 |
|
|
86 | 86 | } |
87 | 87 | } |
88 | 88 |
|
89 | | - if ($::operatingsystem == 'Amazon') and (versioncmp($::operatingsystemmajrelease, '4') >= 0) |
90 | | - or ($::operatingsystem == 'Amazon') and (versioncmp($::operatingsystemmajrelease, '2') >= 0) { |
| 89 | + if ($facts['os']['name'] == 'Amazon') and (versioncmp($facts['os']['release']['major'], '4') >= 0) |
| 90 | + or ($facts['os']['name'] == 'Amazon') and (versioncmp($facts['os']['release']['major'], '2') >= 0) { |
91 | 91 | service { $service_name: |
92 | 92 | ensure => $ensure, |
93 | 93 | enable => $enable, |
|
135 | 135 |
|
136 | 136 | # Redhat 7 selinux user context for /etc/sysconfig/iptables is set to system_u |
137 | 137 | # Redhat 7 selinux type context for /etc/sysconfig/iptables is set to system_conf_t |
138 | | - case $::selinux { |
| 138 | + case $facts['os']['selinux']['enabled'] { |
139 | 139 | #lint:ignore:quoted_booleans |
140 | 140 | 'true',true: { |
141 | | - case $::operatingsystem { |
| 141 | + case $facts['os']['name'] { |
142 | 142 | 'CentOS': { |
143 | | - case $::operatingsystemrelease { |
| 143 | + case $facts['os']['release']['full'] { |
144 | 144 | /^6\..*/: { |
145 | 145 | $seluser = 'unconfined_u' |
146 | 146 | $seltype = 'system_conf_t' |
|
0 commit comments