Code Monkey home page Code Monkey logo

puppet-reprepro's Introduction

puppet reprepro module

This module assists with creating a local apt repository.

The only use-case it has been tested with has been to create a repository of pre-built packages. For example, I create a local repository of Puppet 2.7.x packages by downloading them from the official Puppet repository and then adding them to my local repo.

A Full Example

Using Puppet to create GPG keys is a bit complicated -- for example, the Puppet run could time out before the key is actually made. Because of this, I recommend creating the key manually:

$ su - reprepro
$ gpg --gen-key

# Configure as necessary.
# Note that you will have to maintain reprepro manually if you
# choose to use a passphrase.

$ gpg --export --armor [email protected] > /etc/puppet/modules/reprepro/files/localpkgs.gpg

# Alternatively, you can run the above commands as root and then later
# copy them to the reprepro user's home directory. This is a way to get
# around the chicken-and-egg scenario of having to create a key owned
# by a user that won't exist until after using the reprepro module.

The following is a full-stack example. This will create a reprepro-based repository, configure apache to allow access to the repository via http, and install the repository to your local apt configuration.

Once this is all set up, you can then add packages to ${basedir}/${repository}/tmp/${name}. reprepro will install packages left in that directory into the repository every 5 minutes via cron.

# Base Directory shortcut
$basedir = '/var/lib/apt/repo'

# Main reprepro class
class { 'reprepro':
  basedir => $basedir,
}

# Set up a repository
reprepro::repository { 'localpkgs':
  ensure  => present,
  basedir => $basedir,
  options => ['basedir .'],
}

# Create a distribution within that repository
reprepro::distribution { 'precise':
  basedir       => $basedir,
  repository    => 'localpkgs',
  origin        => 'Foobar',
  label         => 'Foobar',
  suite         => 'precise',
  architectures => 'amd64 i386',
  components    => 'main contrib non-free',
  description   => 'Package repository for local site maintenance',
  sign_with     => 'F4D5DAA8',
  not_automatic => 'No',
}

# Set up apache
class { 'apache': }

# Make your repo publicly accessible
apache::vhost { 'localpkgs':
  port       => '80',
  docroot    => '/var/lib/apt/repo/localpkgs',
  servername => 'apt.example.com',
  require    => Reprepro::Distribution['precise'],
}

# Ensure your public key is accessible to download
file { '/var/lib/apt/repo/localpkgs/localpkgs.gpg':
  ensure  => present,
  owner   => 'www-data',
  group   => 'reprepro',
  mode    => '0644',
  source  => 'puppet:///modules/reprepro/localpkgs.gpg',
  require => Apache::Vhost['localpkgs'],
}

# Set up an apt repo
apt::source { 'localpkgs':
  location    => 'http://apt.example.com',
  release     => 'precise',
  repos       => 'main contrib non-free',
  key         => 'F4D5DAA8',
  key_source  => 'http://apt.example.com/localpkgs.gpg',
  require     => File['/var/lib/apt/repo/localpkgs/localpkgs.gpg'],
  include_src => false,
}

Credits

This module was based off of the existing work done by saz and camptocamp.

puppet-reprepro's People

Contributors

jtopjian avatar saz avatar spali avatar mbornoz avatar evgeni avatar deric avatar inkblot avatar

Watchers

Aaron Hicks avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.