Puppet Class: foreman_proxy::plugin::discovery

Inherits:
foreman_proxy::plugin::discovery::params
Defined in:
manifests/plugin/discovery.pp

Overview

Foreman Proxy Discovery plugin

Install the discovery plugin and images on smart proxies

Parameters:

$install_images

Download and extract the discovery image

Advanced parameters:

$enabled

Whether the module is enabled or disabled.

$version

The version to ensure

$listen_on

When enabled, it’s configured to listen on HTTPS (default), HTTP or both.

$tftp_root

TFTP root directory where extracted discovery image will be installed

$source_url

source URL to download from

$image_name

tarball with images

Parameters:

  • enabled (Boolean) (defaults to: true)
  • version (Optional[String]) (defaults to: undef)
  • listen_on (Foreman_proxy::ListenOn) (defaults to: 'https')
  • install_images (Boolean) (defaults to: $foreman_proxy::plugin::discovery::params::install_images)
  • tftp_root (Stdlib::Absolutepath) (defaults to: $foreman_proxy::plugin::discovery::params::tftp_root)
  • source_url (Stdlib::HTTPUrl) (defaults to: $foreman_proxy::plugin::discovery::params::source_url)
  • image_name (String) (defaults to: $foreman_proxy::plugin::discovery::params::image_name)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'manifests/plugin/discovery.pp', line 22

class foreman_proxy::plugin::discovery (
  Boolean $enabled = true,
  Optional[String] $version = undef,
  Foreman_proxy::ListenOn $listen_on = 'https',
  Boolean $install_images = $foreman_proxy::plugin::discovery::params::install_images,
  Stdlib::Absolutepath $tftp_root = $foreman_proxy::plugin::discovery::params::tftp_root,
  Stdlib::HTTPUrl $source_url = $foreman_proxy::plugin::discovery::params::source_url,
  String $image_name = $foreman_proxy::plugin::discovery::params::image_name,
) inherits foreman_proxy::plugin::discovery::params {
  foreman_proxy::plugin::module { 'discovery':
    enabled   => $enabled,
    feature   => 'Discovery',
    listen_on => $listen_on,
    version   => $version,
  }

  if $install_images {
    $tftp_root_clean = regsubst($tftp_root, '/$', '')

    foreman_proxy::remote_file { "${tftp_root_clean}/boot/${image_name}":
      remote_location => "${source_url}${image_name}",
      mode            => '0644',
    } ~> exec { "untar ${image_name}":
      command => "tar xf ${image_name}",
      path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
      cwd     => "${tftp_root_clean}/boot",
      creates => "${tftp_root_clean}/boot/fdi-image/initrd0.img",
    }
  }
}