Puppet Class: foreman

Inherits:
foreman::params
Defined in:
manifests/init.pp

Overview

Class: foreman

A SIMP based setup of the Foreman. SIMP strips out all non-essential features of the Foreman and provides a basic web interface for Puppet reporting and information.

Parameters

access_log

Type: Absolute Path/String Default: ‘/var/log/httpd/foreman_access.log’

The httpd access log for the Foreman web UI.

admin_pass

Type: String Default: Randomly generated by passgen

The password for the admin user, used to log into the Foreman web UI.

error_log

Type: Absolute Path/String Default: ‘/var/log/httpd/foreman_error.log’

The error log for the Foreman web UI.

host_cert_source

Type: Absolute Path/String Default: ”

Specifies where the host PKI keys are kept. If use_simp_pki is set to false, then the hosts keys will be copied from here into the foreman space.

passenger_app_root

Type: Absolute Path/String Default: ‘/usr/share/foreman’

The directory which Passenger will run inside of.

passenger_ruby

Type: Executable/String Default: ‘/usr/bin/tfm-ruby’

The ruby executable that Passenger will use.

server

Type: Hostname/String Default: <fqdn_puppetmasteer>

The server that the Foreman will run on.

use_ssl

Type: Boolean Default: True

Whether or not to include an SSL conf for the Foreman web UI.

use_simp_pki

Type: Boolean Default: True

Whether or not to copy PKI certs into the foreman space using the SIMP pki::copy tool.

vhost_root

Type: Absolute Path/String Default: ‘/usr/share/foreman/public’

The root of the Foreman web interface.

Variables

fqdn

Used to set the VirtualHost ServerName variable in the Apache conf file.

Authors

Kendall Moore <kmoore@keywcorp.com>

Parameters:

  • access_log (Any) (defaults to: '/var/log/httpd/foreman_access.log')
  • admin_user (Any) (defaults to: hiera('foreman::admin_user', $::foreman::params::admin_user))
  • admin_password (Any) (defaults to: hiera('foreman::admin_password', $::foreman::params::admin_password))
  • error_log (Any) (defaults to: '/var/log/httpd/foreman_error.log')
  • host_cert_source (Any) (defaults to: '')
  • log_level (Any) (defaults to: hiera('foreman::log_level', $::foreman::params::log_level))
  • passenger_app_root (Any) (defaults to: '/usr/share/foreman')
  • passenger_ruby (Any) (defaults to: '/usr/bin/tfm-ruby')
  • puppet_cert_source (Any) (defaults to: "${::puppet_vardir}/ssl")
  • server (Any) (defaults to: $::foreman::params::server)
  • trusted_puppetmaster_hosts (Any) (defaults to: hiera('puppet::server', $::fqdn))
  • use_ssl (Any) (defaults to: true)
  • ssl_dir (Any) (defaults to: '/etc/foreman/ssl')
  • use_simp_pki (Any) (defaults to: true)
  • vhost_root (Any) (defaults to: '/usr/share/foreman/public')


82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'manifests/init.pp', line 82

class foreman (
  $access_log         = '/var/log/httpd/foreman_access.log',
  $admin_user         = hiera('foreman::admin_user', $::foreman::params::admin_user),
  $admin_password     = hiera('foreman::admin_password', $::foreman::params::admin_password),
  $error_log          = '/var/log/httpd/foreman_error.log',
  $host_cert_source   = '',
  $log_level          = hiera('foreman::log_level', $::foreman::params::log_level),
  $passenger_app_root = '/usr/share/foreman',
  $passenger_ruby     = '/usr/bin/tfm-ruby',
  $puppet_cert_source = "${::puppet_vardir}/ssl",
  $server             = $::foreman::params::server,
  $trusted_puppetmaster_hosts = hiera('puppet::server', $::fqdn),
  $use_ssl            = true,
  $ssl_dir            = '/etc/foreman/ssl',
  $use_simp_pki       = true,
  $vhost_root         = '/usr/share/foreman/public'
) inherits foreman::params {

  validate_absolute_path($access_log)
  validate_absolute_path($error_log)
  validate_absolute_path($passenger_app_root)
  validate_absolute_path($passenger_ruby)
  validate_absolute_path($vhost_root)
  validate_bool($use_ssl)
  validate_net_list($server)
  validate_bool($use_simp_pki)
  validate_absolute_path($vhost_root)

  include '::foreman::install'
  include '::foreman::database'
  include '::foreman::settings'
  include '::apache::conf'
  include '::foreman::passenger'
  include '::foreman::proxy'
  include '::foreman::config'
  if $use_ssl {
    # For variable references
    include '::apache::ssl'
    include '::foreman::config::ssl'

    Class['::apache::ssl'] -> Class['::foreman::config::ssl'] -> Class['::foreman::service']
  }
  include '::foreman::service'

  Class['::foreman::install'] -> Class['::foreman::database']
  Class['::foreman::database'] -> Class['::foreman::settings'] ~> Class['::foreman::service']
  Class['::foreman::config'] -> Class['::foreman::passenger'] ~> Class['::foreman::service']
  Class['::foreman::config'] ~> Class['::foreman::service']
  Class['::foreman::service'] -> Class['::foreman::proxy']

  foreman::user { 'admin':
    auth_source => 'Internal',
    password    => $admin_password,
    api_admin   => true,
    web_admin   => true,
    email       => "root@${::domain}",
    firstname   => 'Admin',
    lastname    => 'User',
    require     => [
      Class['::foreman::service'],
      Service['httpd']
    ]
  }

  Foreman::User <| title == 'admin' |> -> Foreman::User <| title != 'admin' |>
  Foreman::User <| title == 'admin' |> -> Foreman::Smart_proxy <| |>
  Foreman::User <| title == 'admin' |> -> Foreman::Auth_source <| |>
  Foreman::User <| title == 'admin' |> -> Foreman::Location <| |>
}