apt: Parameterize apt::sources

This commit is contained in:
Ossi Salmi 2013-10-21 11:28:11 +03:00
parent 7f28f80995
commit a7f94e1060
2 changed files with 28 additions and 68 deletions

View file

@ -75,31 +75,35 @@ define apt::ppa($ensure = "present") {
# Configure /etc/apt/sources.list
#
# === Global variables
# === Parameters
#
# $apt_archive_url:
# Base URL of archive repository. Defaults to http://archive.ubuntu.com/ubuntu/.
# $apt_security_url:
# Base URL of security repository. Defaults to http://security.ubuntu.com/ubuntu/.
# $archive_url:
# Base URL of archive repository.
# Defaults to "mirror://mirrors.ubuntu.com/mirrors.txt".
#
class apt::sources {
# $security_url:
# Base URL of security repository.
# Defaults to "mirror://mirrors.ubuntu.com/mirrors.txt".
#
# $backports:
# Boolean for enabling the backports repositories.
# Defaults to true.
#
class apt::sources(
$archive_url="mirror://mirrors.ubuntu.com/mirrors.txt",
$security_url="mirror://mirrors.ubuntu.com/mirrors.txt",
$backports=true
) {
tag("bootstrap")
include apt
if !$apt_archive_url {
$apt_archive_url = "http://archive.ubuntu.com/ubuntu/"
}
if !$apt_security_url {
$apt_security_url = "http://security.ubuntu.com/ubuntu/"
}
file { "/etc/apt/sources.list":
ensure => present,
mode => "0644",
owner => root,
group => root,
owner => "root",
group => "root",
content => template("apt/sources.list.erb"),
notify => Exec["apt-get-update"],
}

View file

@ -1,57 +1,13 @@
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb <%= @archive_url %> <%= @lsbdistcodename %> main restricted universe multiverse
deb-src <%= @archive_url %> <%= @lsbdistcodename %> main restricted universe multiverse
deb <%= @apt_archive_url %> <%= @lsbdistcodename %> main restricted
deb-src <%= @apt_archive_url %> <%= @lsbdistcodename %> main restricted
deb <%= @archive_url %> <%= @lsbdistcodename %>-updates main restricted universe multiverse
deb-src <%= @archive_url %> <%= @lsbdistcodename %>-updates main restricted universe multiverse
## Major bug fix updates produced after the final release of the
## distribution.
deb <%= @apt_archive_url %> <%= @lsbdistcodename %>-updates main restricted
deb-src <%= @apt_archive_url %> <%= @lsbdistcodename %>-updates main restricted
deb <%= @security_url %> <%= @lsbdistcodename %>-security main restricted universe multiverse
deb-src <%= @security_url %> <%= @lsbdistcodename %>-security main restricted universe multiverse
<% if @backports == true -%>
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb <%= @apt_archive_url %> <%= @lsbdistcodename %> universe
deb-src <%= @apt_archive_url %> <%= @lsbdistcodename %> universe
deb <%= @apt_archive_url %> <%= @lsbdistcodename %>-updates universe
deb-src <%= @apt_archive_url %> <%= @lsbdistcodename %>-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb <%= @apt_archive_url %> <%= @lsbdistcodename %> multiverse
deb-src <%= @apt_archive_url %> <%= @lsbdistcodename %> multiverse
deb <%= @apt_archive_url %> <%= @lsbdistcodename %>-updates multiverse
deb-src <%= @apt_archive_url %> <%= @lsbdistcodename %>-updates multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
<% if @apt_backports -%>
deb <%= @apt_archive_url %> <%= @lsbdistcodename %>-backports main restricted universe multiverse
deb-src <%= @apt_archive_url %> <%= @lsbdistcodename %>-backports main restricted universe multiverse
<% else -%>
# deb <%= @apt_archive_url %> <%= @lsbdistcodename %>-backports main restricted universe multiverse
# deb-src <%= @apt_archive_url %> <%= @lsbdistcodename %>-backports main restricted universe multiverse
deb <%= @archive_url %> <%= @lsbdistcodename %>-backports main restricted universe multiverse
deb-src <%= @archive_url %> <%= @lsbdistcodename %>-backports main restricted universe multiverse
<% end -%>
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu <%= @lsbdistcodename %> partner
# deb-src http://archive.canonical.com/ubuntu <%= @lsbdistcodename %> partner
deb <%= @apt_security_url %> <%= @lsbdistcodename %>-security main restricted
deb-src <%= @apt_security_url %> <%= @lsbdistcodename %>-security main restricted
deb <%= @apt_security_url %> <%= @lsbdistcodename %>-security universe
deb-src <%= @apt_security_url %> <%= @lsbdistcodename %>-security universe
deb <%= @apt_security_url %> <%= @lsbdistcodename %>-security multiverse
deb-src <%= @apt_security_url %> <%= @lsbdistcodename %>-security multiverse