Puppet Class: approx

Defined in:
manifests/init.pp

Overview

Approx apt proxy server, main class

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

Examples:

hiera usage to configure repositories

approx::config:
  debian:
    url: 'http://ftp.ch.debian.org/debian'
  debian-security:
    url: 'http://security.debian.org/debian-security'
  debian-backports:
    url: 'http://ftp.ch.debian.org/debian-backports'

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'

Parameters:

  • conffile (String)

    path to the configuration file

  • cache (String)

    path of the approx cache directory

  • ensure_cache (Boolean) (defaults to: true)

    if true it ensures that the cache directories are created

  • interval (Integer)

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

  • max_rate (Variant[Integer, Enum['unlimited']])

    maximum download rate from remote repositories, in bytes per second

  • max_redirects (Integer)

    maximum number of HTTP redirections

  • user (String)

    user that owns the files in cache

  • group (String)

    group that owns the files in cache

  • syslog (String)

    syslog facility to use when logging

  • pdiffs (Boolean)

    whether to support IndexFile diffs

  • offline (Boolean)

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

  • max_wait (Integer)

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

  • verbose (Boolean)

    whether informational messages should be printed in the log

  • debug (Boolean)

    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)



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
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'manifests/init.pp', line 63

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

  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 )
  }
}