Skip to content

A puppet module for apt. According to Example42 NextGen spec.

Notifications You must be signed in to change notification settings

lermit/puppet-apt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Puppet module: apt

This is a Puppet module for apt based on the second generation layout (“NextGen”) of Example42 Puppet Modules.

Made by Romain THERRAT / Carpe-Hora

Official site: www.example42.com

Official git repository: github.com/lermit/puppet-apt

Released under the terms of Apache 2 License.

This module requires functions provided by the Example42 Puppi module (you need it even if you don’t use and install Puppi)

For detailed info about the logic and usage patterns of Example42 modules check the DOCS directory on Example42 main modules set.

USAGE - Basic management

  • Install apt with default settings

    class { 'apt': }
  • Install a specific version of apt package

    class { 'apt':
      version => '1.0.1',
    }
  • Remove apt package

    class { 'apt':
      absent => true
    }
  • Enable auditing without without making changes on existing apt configuration files

    class { 'apt':
      audit_only => true
    }

USAGE - Repository management

  • Add a repository

    apt::repository { "ubuntu":
      url        => "http://it.archive.ubuntu.com/ubuntu/",
      distro     => 'lucid',
      repository => 'main restricted',
    }

This will generate somethink like ‘deb it.archive.ubuntu.com/ubuntu/ lucid main restricted’ into /etc/apt/source.list.d/ubuntu.list

  • Add a source repository

    apt::repository { "ubuntu-src":
      url        => "http://it.archive.ubuntu.com/ubuntu/",
      distro     => 'lucid',
      repository => 'main restricted',
      source     => true,
    }

This will generate somethink like ‘deb-src it.archive.ubuntu.com/ubuntu/ lucid main restricted’ into /etc/apt/source.list.d/ubuntu-src.list

  • Remove a repository

    apt::repository { "ubuntu":
      ensure     => absent,
      url        => "http://it.archive.ubuntu.com/ubuntu/",
      distro     => 'lucid',
      repository => 'main restricted',
    }

USAGE - Automatic update

  • Automaticaly update and install package

    class { "apt":
      update_present => true,
    }
  • Set task recurrence. Here we want to proceed a apt-get update each day, download package each day, upgrade each 2 days and apt-get autoclean each 4 days.

    class { "apt":
      update_present           => true,
      update_periodic_update   => 1,
      update_periodic_download => 1,
      update_periodic_upgrade  => 2,
      update_periodic_clean    => 4,
    }
  • Manage archive retention. Here we keep archive for 7 days with a minimum of 2 days. The total size of the archive is up to 700MB.

    ...
    update_periodic_max_age  => 7,
    update_periodic_min_age  => 2,
    update_periodic_max_size => 700,
    ...
  • Specify own template.

    ...
    update_template => 'example42/apt-update.cfg',
    ...
  • Specify own source.

    ...
    update_source => [ "puppet:///modules/example42/apt/update.cfg-${hostname}" , "puppet:///modules/example42/apt/update.cfg"],
    ...

USAGE - Apt proxy

  • Use a proxy (here apt-cache02.example.com:3142)

    class { 'apt':
      proxy => 'http://apt-cache02.example.com:3142',
    }
  • Use my own proxy template

    class { 'apt':
      proxy          => 'http://apt-cache02.example.com:3142',
      proxy_template => 'my/template.erb',
    }
  • Use my own proxy source config file

    ...
      proxy_source => [
        'puppet:///modules/lab42/apt/proxy.conf-${hostname}',
        'puppet:///modules/lab42/apt/proxy.conf',
      ],
    ...
  • Change default proxy config file (default are /etc/apt/apt.conf.d/01proxy)

    ...
      proxy_config_file => '/etc/apt/apt.conf.d/the-proxy.conf',
    ...

USAGE - Apt update

  • Notify an apt database update

    ...
    notify => Exec['apt_update'],
    ...
  • Require a repository installation and update

    ...
    require => [
      Apt::Repository['Ubuntu'],
      Exec['apt_update'],
    ],
    ...

USAGE - Overrides and Customizations

  • Use custom sources for main config file

    class { 'apt':
      source => [ "puppet:///modules/lab42/apt/apt.conf-${hostname}" , "puppet:///modules/lab42/apt/apt.conf" ],
    }
  • Use custom source directory for the whole configuration dir

    class { 'apt':
      source_dir       => 'puppet:///modules/lab42/apt/conf/',
      source_dir_purge => false, # Set to true to purge any existing file not present in $source_dir
    }
  • Use custom template for main config file. Note that template and source arguments are alternative.

    class { 'apt':
      template => 'example42/apt/apt.conf.erb',
    }
  • Automatically include a custom subclass

    class { 'apt':
      my_class => 'apt::example42',
    }

USAGE - Example42 extensions management

  • Activate puppi (recommended, but disabled by default)

    class { 'apt':
      puppi    => true,
    }
  • Activate puppi and use a custom puppi_helper template (to be provided separately with a puppi::helper define ) to customize the output of puppi commands

    class { 'apt':
      puppi        => true,
      puppi_helper => 'myhelper',
    }
  • Activate automatic monitoring (recommended, but disabled by default). This option requires the usage of Example42 monitor and relevant monitor tools modules

    class { 'apt':
      monitor      => true,
      monitor_tool => [ 'nagios' , 'monit' , 'munin' ],
    }
  • Activate automatic firewalling. This option requires the usage of Example42 firewall and relevant firewall tools modules

    class { 'apt':
      firewall      => true,
      firewall_tool => 'iptables',
      firewall_src  => '10.42.0.0/24',
      firewall_dst  => $ipaddress_eth0,
    }

About

A puppet module for apt. According to Example42 NextGen spec.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published