Defined Type: selinux::boolean

Defined in:
manifests/boolean.pp

Summary

Manage the state of an SELinux boolean.

Overview

Examples:

Enable ‘named_write_master_zones` boolean

selinux::boolean{ 'named_write_master_zones':
   ensure => 'on',
}

Ensure ‘named_write_master_zones` boolean is disabled

selinux::boolean{ 'named_write_master_zones':
   ensure => 'off',
}

Parameters:

  • ensure (Variant[Boolean, Enum['on', 'off', 'present', 'absent']]) (defaults to: 'on')

    Set to on or off

  • persistent (Boolean) (defaults to: true)

    Set to false if you don’t want it to survive a reboot.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'manifests/boolean.pp', line 16

define selinux::boolean (
  Variant[Boolean, Enum['on', 'off', 'present', 'absent']] $ensure = 'on',
  Boolean $persistent = true,
) {
  include selinux

  Anchor['selinux::module post']
  -> Selinux::Boolean[$title]
  -> Anchor['selinux::end']

  $ensure_real = $ensure ? {
    true    => 'on',
    false   => 'off',
    default => $ensure,
  }

  $value = $ensure_real ? {
    /(?i-mx:on|present)/ => 'on',
    /(?i-mx:off|absent)/ => 'off',
    default              => undef,
  }

  # Do nothing unless SELinux is enabled
  if $facts['os']['selinux']['enabled'] {
    selboolean { $name:
      value      => $value,
      persistent => $persistent,
    }
  }
}