Puppet Class: useradd::sysconfig_init

Defined in:
manifests/sysconfig_init.pp

Overview

Allow for the configuration of /etc/sysconfig/init

See /usr/share/doc/initscripts-<version>/sysconfig.txt for variable

definitions.

For all ‘setcolor` variables, use the following color options as a string:

* default
* black
* red
* green
* yellow
* blue
* magenta
* cyan
* white

author: SIMP Team <simp@simp-project.com>

Parameters:

  • bootup (Useradd::Bootup) (defaults to: 'color')
  • res_col (Integer) (defaults to: 60)
  • move_to_col (Optional[String]) (defaults to: undef)
    • By default, undef will add the code ‘“echo -en \033[$RES_COLG”` to /etc/sysconfig/init

    • Optional string of code will be substituted if included

  • setcolor_success (String) (defaults to: 'green')
  • setcolor_failure (String) (defaults to: 'red')
  • setcolor_warning (String) (defaults to: 'yellow')
  • setcolor_normal (String) (defaults to: 'default')
  • single_user_login (Stdlib::AbsolutePath) (defaults to: '/sbin/sulogin')
  • loglvl (Integer[1,8]) (defaults to: 3)
  • prompt (Boolean) (defaults to: false)
  • autoswap (Boolean) (defaults to: false)

    AUTOSWAP option is only useful in el6. Not present in el7 or later.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'manifests/sysconfig_init.pp', line 35

class useradd::sysconfig_init (
  Useradd::Bootup      $bootup            = 'color',
  Integer              $res_col           = 60,
  Optional[String]     $move_to_col       = undef,
  String               $setcolor_success  = 'green',
  String               $setcolor_failure  = 'red',
  String               $setcolor_warning  = 'yellow',
  String               $setcolor_normal   = 'default',
  Stdlib::AbsolutePath $single_user_login = '/sbin/sulogin',
  Integer[1,8]         $loglvl            = 3,
  Boolean              $prompt            = false,
  Boolean              $autoswap          = false,
) {

  if 'systemd' in $facts['init_systems'] {
    $_unit_file_content = @("END")
      [Service]
      ExecStart=
      ExecStart=-/bin/sh -c "${single_user_login}; /usr/bin/systemctl --fail --no-block default"
      | END

    systemd::dropin_file{ 'emergency_exec.conf':
      unit    => 'emergency.service',
      content => $_unit_file_content
    }

    systemd::dropin_file{ 'rescue_exec.conf':
      unit    => 'rescue.service',
      content => $_unit_file_content
    }
  }

  file { '/etc/sysconfig/init':
    ensure  => 'file',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => template('useradd/etc/sysconfig/init.erb')
  }
}