Puppet Class: coretx::root

Defined in:
manifests/root.pp

Overview

Class: coretx::root

Manage the root superuser Resource documentation (user): docs.puppet.com/puppet/latest/types/user.html

Parameters:

  • root_ssh_keys (Hash) (defaults to: {})
  • root_ssh_dir (String) (defaults to: '.ssh')
  • root_ssh_keys_file (String) (defaults to: 'authorized_keys')
  • root_purge_ssh_keys (Boolean) (defaults to: false)
  • root_acc_expiry (Optional[String]) (defaults to: undef)
  • root_passwd_hash (Optional[String]) (defaults to: undef)
  • root_passwd_max_age (Optional[String]) (defaults to: undef)
  • root_passwd_min_age (Optional[String]) (defaults to: undef)


6
7
8
9
10
11
12
13
14
15
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
# File 'manifests/root.pp', line 6

class coretx::root (

  Hash $root_ssh_keys                   = {},
  String $root_ssh_dir                  = '.ssh',
  String $root_ssh_keys_file            = 'authorized_keys',
  Boolean $root_purge_ssh_keys          = false,
  Optional[String] $root_acc_expiry     = undef,
  Optional[String] $root_passwd_hash    = undef,
  Optional[String] $root_passwd_max_age = undef,
  Optional[String] $root_passwd_min_age = undef,

)
{
  user { 'root':
    ensure           => present,
    home             => '/root',
    expiry           => $root_acc_expiry,
    password         => $root_passwd_hash,
    password_max_age => $root_passwd_max_age,
    password_min_age => $root_passwd_min_age,
    purge_ssh_keys   => $root_purge_ssh_keys,
  }

  if !empty(root_ssh_keys) {
    file { "/root/${root_ssh_dir}":
      ensure => directory,
      owner  => 'root',
      group  => 'root',
      mode   => '0700',
    }
    file { "/root/${root_ssh_dir}/${root_ssh_keys_file}":
      ensure  => present,
      owner   => 'root',
      group   => 'root',
      mode    => '0600',
      content => template('coretx/authorized_keys_root.erb'),
    }
  }
}