Version information
This version is compatible with:
- Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x
- Puppet >= 5.0.0 < 7.0.0
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'arden-local_rpm_repo', '0.2.1'
Learn more about managing modules with a PuppetfileDocumentation
local_rpm_repo
Table of Contents
- Description
- Setup - The basics of getting started with local_rpm_repo
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Description
This module allows you to create and deploy a http based RPM repository using a tar of RPMs as a source or an external puppet fileserver. This can be helpful for environments where some number of locally created and maintained RPMs must be distributed to a set of systems.
We use this to automatically maintain a simple repo containing a ppc64 build of puppet-agent.
Setup
What local_rpm_repo affects
It creates an apache vhost on the target machine and schedules a cron job of createrepo
for each repository specified in the config. The repos will be within the specified vhost in their own folders.
Setup Requirements - Tar Source
When an http or https URL is provided the module assumes you have a simple web server configured to host a tar file for each repository you intend to deploy.
Tar files for each repository should be created and named with a format similar to ${reponame}-${version}.tar
. For example, a repo named test-repo with a version string of 1.6.3.0 would have a corresponding tar named test-repo-1.6.3.0.tar
. It is possible to override the ${reponame}
portion of this string with an alternate prefix. See the reference documentation for detail.
Setup Requirements - Puppet Source
Configure a custom file server mount point to host the source data for your repositories. The base_url
should contain a directory corresponding to the repository name or the prefix override configured for that repository. Within that directory there should be a folder for the target version which contains the desired RPMs in the expected deployment structure.
Usage
Tar Sources
The example below will configure three repos named repo1, repo2, and repo3 respectively on the target node. This node will expect connections to arrive to the vhost yum.example.com
.
When puppet is applying this configuration it will expect to be able to download the following three files:
http://bin.example.com/data/repo1-5.0.3.1.tar
http://bin.example.com/data/repo2-1.0.7.0.tar
http://bin.example.com/data/repo3-dev-1.0.0.0.tar
class local_rpm_repo {
base_url_default => 'http://bin.example.com/data/',
mirror_fqdn => 'yum.example.com',
repo_list => {
'repo1' => { 'version' => '5.0.3.1' },
'repo2' => { 'version' => '1.0.7.0' },
'repo3' => {
'version' => '5.0.3.1',
'prefix' => 'repo3-dev',
},
},
}
Alternatively the same configuration can be achieved via hiera:
---
local_rpm_repo::base_url_default: 'http://bin.example.com/data/'
local_rpm_repo::mirror_fqdn: 'yum.example.com'
local_rpm_repo::repo_list:
repo1:
version: '5.0.3.1'
repo2:
version: '1.0.7.0'
repo3:
prefix: 'repo3-dev'
version: '1.0.0.0'
Once applied, the following changes will be implemented:
The /var/yumrepos
directory will contain the following sub folders:
/var/yumrepos/repo1/versions/5.0.3.1/
/var/yumrepos/repo2/versions/1.0.7.0/
/var/yumrepos/repo3/versions/1.0.0.0/
The contents of the three tar files detailed above will be extracted to these directories.
An Apache vhost will be created listening at yum.example.com
serving the /var/yumrepos
directory.
Puppet Fileserver
This method uses the source
directive on the puppet file resource type to recursively replicate the contents of the specified source folder as the repo version.
---
local_rpm_repo::base_url_default: 'http://bin.example.com/data/'
local_rpm_repo::mirror_fqdn: 'yum.example.com'
local_rpm_repo::repo_list:
repo1:
version: '5.0.3.1'
repo2:
base_url: 'puppet:///external_files'
version: '1.0.7.0'
In the example above repo1 will be declared from the tar http://bin.example.com/data/repo1-5.0.3.1.tar
as normal, however, repo2 will replicate the contents of puppet:///external_files/repo2/1.0.7.0
to it's version directory.
Limitations
- Currently GPG signing of repositories is not supported.
Development
TBD.
Contributors
Check out the contributor list.
Reference
Table of Contents
Classes
local_rpm_repo
: Creates and hosts the specified RPM repositories.
Defined types
local_rpm_repo::puppet_source
: Repo with rpm files sourced from a puppet file server.local_rpm_repo::tar_source
: Repo with instance data retrieve from a tar file.
Classes
local_rpm_repo
A simple class to create and manage locally maintained repositories using tar file containing the RPMs.
Examples
Definition of three repositories
class { 'local_rpm_repo':
base_url_default => 'http://bin.example.com/data/',
mirror_fqdn => 'yum.example.com',
repo_list => {
'repo1' => { version => '1.0.0.0' },
'repo2' => { version => '1.0.0.0' },
'repo3' => { version => '1.0.0.0' },
},
}
Parameters
The following parameters are available in the local_rpm_repo
class.
mirror_fqdn
Data type: Stdlib::Fqdn
Fully Qualified Domain Name which will be used as the apache vhost name on this server. Note that this FQDN should resolve to this server.
base_url_default
Data type: Optional[Local_rpm_repo::SourceUrl]
This specifies the URL from which the repo tar should be extracted or the remote files should be replicated if a specific url is not provided in repo_list. When used, the application assumes the source data is located within the specified directory.
For example, given a repo named 'test-repo' at version '1.0.5.1':
http://bin.example.org/data
- expects http://bin.example.org/data/test-repo-1.0.5.1.tar to existpuppet:///repo_files
- expects the folder structure 'puppet:///repo_files/test-repo/1.0.5.1'
repo_base_path
Data type: Stdlib::AbsolutePath
Absolute path to the parent directory of the yum repository
Default value: '/var/yumrepos'
repo_base_cache_path
Data type: Stdlib::AbsolutePath
Absolute path to the parent directory of the yum repository cache directory.
Default value: '/var/cache/yumrepos'
repo_list
Data type: Hash[String, Local_rpm_repo::RepoData]
A hash where the keys are the names of the repos to be deployed. The following options are supported for each repo:
- version - version of the source repo file
- source_prefix - prefix of the file, defaults to the repo name.
@note At least one repository must be specified
Default value: {}
suppress_cron_stdout
Data type: Boolean
When enabled stdout generated by the createrepo command(s) will be directed
to /dev/null
. This is very helpful if these messages would be emailed
unnecessarily in your environment.
Default value: true
Defined types
local_rpm_repo::puppet_source
This type is an implementation detail and should not be declared directly!
Parameters
The following parameters are available in the local_rpm_repo::puppet_source
defined type.
version
Data type: Local_rpm_repo::Version
Version number to instantiate.
base_url
Data type: Local_rpm_repo::PuppetUrl
Puppet path to the RPM directory. See the repo::base_url_default for further details.
prefix
Data type: String
String prepended to the version number to determine the source tar file name. Note that this field is a namevar.
Default value: $name
versions_path
Data type: Stdlib::AbsolutePath
Absolute path to the versions subdirectory for this repository.
local_rpm_repo::tar_source
This type is an implementation detail and should not be declared directly!
Parameters
The following parameters are available in the local_rpm_repo::tar_source
defined type.
version
Data type: Local_rpm_repo::Version
Version number to instantiate.
base_url
Data type: Variant[Stdlib::Httpurl, Stdlib::Httpsurl]
Location containing the source tar file. See the repo::base_url_default for further details.
prefix
Data type: String
String prepended to the version number to determine the source tar file name. Note that this field is a namevar.
Default value: $name
versions_path
Data type: Stdlib::AbsolutePath
Absolute path to the versions subdirectory for this repository.
Changelog
All notable changes to this project will be documented in this file.
Release 0.2.1
Features
- Allow cron output to be suppressed
- Updated to PDK 1.13.0
Release 0.2.0
Features
- Using types for parameters.
- PDK 1.9.1
- Support for puppet custom mount points (file servers)
Bugfixes
- Switched to a refresh-only topology - nolonger has idempotent executions of commands
Release 0.1.2
Bugfixes
- Added checks to prevent the source files from being downloaded even if the repo is already deployed. Note that it doesn't validate the contents of the repo so if it gets corrupted you'll need to delete.
Release 0.1.1
Bugfixes
- Used a series of commands instead of tidy to cleanup old versions as the initial release would simply alternate between removing everything and creating everything.
Release 0.1.0
Features
- Initial release!
Dependencies
- palli-createrepo (>= 2.1.0 < 3.0.0)
- puppetlabs-apache (>= 3.2.0 < 5.0.0)
- puppetlabs-stdlib (>= 4.25.1 < 6.0.0)
- puppetlabs-cron_core (>= 1.0.1 < 2.0.0)