Chef cookbook for setting up a yum repository server
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
attributes
providers
recipes
resources
templates/default
test
.gitignore
.kitchen.yml
.rspec
.rubocop.yml
Berksfile
Berksfile.lock
CHANGELOG.md
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
chefignore
metadata.rb

README.md

yumrepo_server Cookbook

This cookbook configures a Yum repository to be served from your system. It will automatically install and configure the Apache web server (as it's the only server that's available without requiring the EPEL yum repo). It also install the createrepo package for the utilities needed to setup a directory as a yum source.

Requirements

Ruby 1.9 or later

cookbooks

  • apache2
  • logrotate

packages

  • httpd - needed to serve the packages in the repository
  • createrepo - needed to setup the repository
  • logrotate - needed by the httpd package to configure log file management

platforms

Any system that uses Yum and has the required pakcages

Attributes

yumrepo_server::default

  • ['yum']['server']['repo_base_dir']
    Type: String
    Description: The base directory where the repositories will be configured. Will be used as Apache's DocumentRoot
    Default: /var/lib/yum-repo

  • ['yum']['server']['http_aliases']
    Type: Array
    Description: An array of server name aliases to plug in to the httpd config
    Default: [] (empty array)

  • ['yum']['server']['http_port']
    Type: Integer
    Description: The server port to plug in to the httpd config
    Default: 80

  • ['apache']['include_logrotate']
    Type: Boolean
    Description: Flag to determine if logrotate will be configured for Apache logs
    Default: true

Usage

Recipes

yumrepo_server::default

Just include yumrepo_server in your node's run_list:

{
  "name":"my_node",
  "run_list": [
    "recipe[yumrepo_server]"
  ]
}

LWRPs

yumrepo_server

:create action

Create a yum repository inside of the relative path given (will be rooted at node['yum']['server']['repo_base_dir'])

With implied directory

yumrepo_server 'relative/yum/repo/path' do
  action :create
  options "-v --quiet"  # An optional string of options to pass to the createrepo command
  remote_source "http://upstream.com/path" # An optional URL string used as a base to retrieve packages from
  packages %w(pkg1.rpm pkg2.rpm pkg3.rpm)  # An optional array of package names to be configured in the repo (default is all packages). Required with the :remote_source attribute to specify which packages to retrieve.
end

With explicit directory

yumrepo_server 'creates my yum repo' do
  action :create
  dir 'relative/yum/repo/path' # Required relative path to create repo at (this value will be appended to the value of node['yum']['server']['repo_base_dir'])
  options "-v --quiet"  # An optional string of options to pass to the createrepo command
  remote_source "http://upstream.com/path" # An optional URL string used as a base to retrieve packages from
  packages %w(pkg1.rpm pkg2.rpm pkg3.rpm)  # An optional array of package names to be configured in the repo (default is all packages). Required with the :remote_source attribute to specify which packages to retrieve.
end
:update action

Update the the yum repository at the path given

yumrepo_server 'relative/yum/repo/path' do
  action :update
  options "-v --quiet"  # An optional string of options to pass to the createrepo command
end
:delete action

Deletes the repository at the given path (basically delete the directory)

yumrepo_server 'relative/yum/repo/path' do
  action :delete
end

License and Authors

Authors: Michael Morris
License: 3-clause BSD