Puppet Class: approx

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

Overview

Approx apt proxy server, main class

specific repositories have to be defined with apt::approx::repository.

Parameters:

  • conffile (String) (defaults to: $approx::params::conffile)

    path to the configuration file

  • cache (String) (defaults to: $approx::params::cache)

    path of the approx cache directory

  • ensure_cache (Boolean) (defaults to: true)

    if true it ensures that the cache directories are created

  • interval (Integer) (defaults to: $approx::params::interval)

    time in minutes after which a cached file will be considered too old to deliver

  • max_rate (Variant[Integer, Enum['unlimited']]) (defaults to: $approx::params::max_rate)

    maximum download rate from remote repositories, in bytes per second

  • max_redirects (Integer) (defaults to: $approx::params::max_redirects)

    maximum number of HTTP redirections

  • user (String) (defaults to: $approx::params::user)

    user that owns the files in cache

  • group (String) (defaults to: $approx::params::group)

    group that owns the files in cache

  • syslog (String) (defaults to: $approx::params::syslog)

    syslog facility to use when logging

  • pdiffs (Boolean) (defaults to: $approx::params::pdiffs)

    whether to support IndexFile diffs

  • offline (Boolean) (defaults to: $approx::params::offline)

    whether to deliver (possibly out-of-date) cached files

  • max_wait (Integer) (defaults to: $approx::params::max_wait)

    how many seconds an approx(8) process will wait for a concurrent download

  • verbose (Boolean) (defaults to: $approx::params::verbose)

    whether informational messages should be printed in the log

  • debug (Boolean) (defaults to: $approx::params::debug)

    whether debugging messages should be printed in the log

  • config (Hash) (defaults to: {})

    Hash of repositories to configure

  • create_resources (Hash) (defaults to: {})

    a Hash of Hashes to create additional resources Defaults to {} (do not create any additional resources)

    Example (hiera) to create an xinetd service using puppetlabs-xinetd

    approx::create_resources:

    xinetd::service:
      approx:
        server: '/usr/sbin/approx'
        user: 'approx'

    Will result in executing:

    xinetd::service{'approx':
      server => '/usr/sbin/approx'
      user   => 'approx'


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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'manifests/init.pp', line 49

class approx(
  String $conffile      = $approx::params::conffile,
  Boolean $ensure_cache = true,
  String $cache         = $approx::params::cache,
  Integer $interval      = $approx::params::interval,
  Variant[Integer, Enum['unlimited']] $max_rate      = $approx::params::max_rate,
  Integer $max_redirects = $approx::params::max_redirects,
  String  $user          = $approx::params::user,
  String  $group         = $approx::params::group,
  String  $syslog        = $approx::params::syslog,
  Boolean $pdiffs        = $approx::params::pdiffs,
  Boolean $offline       = $approx::params::offline,
  Integer $max_wait      = $approx::params::max_wait,
  Boolean $verbose       = $approx::params::verbose,
  Boolean $debug         = $approx::params::debug,
  Hash    $config        = {},
  Hash    $create_resources = {},
) inherits approx::params {

  package { 'approx': ensure => 'installed' }

  concat { $conffile:
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    require => Package['approx'],
  }

  concat::fragment{ 'approx.conf_header':
    target  => $conffile,
    content => template('approx/approx.conf_header.erb'),
    order   => '00',
  }

  if $ensure_cache {
    file { $cache :
      ensure  => 'directory',
      owner   => $user,
      group   => $group,
      mode    => '0755',
      require => Package['approx'],
    }
  }


  create_resources('approx::repository',$config)

  $create_resources.each | $res, $vals | {
    create_resources($res, $vals )
  }
}