Initial version of apt module.

This commit is contained in:
Timo Mkinen 2010-10-25 11:40:37 +03:00
parent 92bbdc0799
commit 9905c67cc8
2 changed files with 70 additions and 0 deletions

47
apt/manifests/init.pp Normal file
View file

@ -0,0 +1,47 @@
# Mirroring tool for apt repositories
#
# === Global variables
#
# $aptmirror_threads:
# Number of download threads to use, defaults to 5.
#
# $aptmirror_server:
# Server to use for mirroring, defaults to
# http://archive.ubuntu.com/ubuntu
#
# $aptmirror_list:
# List of Ubuntu versions to mirror, defaults to [ "lucid" ].
#
class apt::mirror {
if ! $aptmirror_threads {
$aptmirror_threads = 10
}
if ! $aptmirror_server {
$aptmirror_server = "http://archive.ubuntu.com/ubuntu"
}
if ! $aptmirror_list {
$aptmirror_list = [ "lucid" ]
}
package { "apt-mirror":
ensure => installed,
}
file { "/etc/apt/miror.list":
ensure => present,
name => $operatingsystem ? {
centos => "/etc/apt-mirror.list",
default => "/etc/apt/miror.list",
},
contents => template("apt/mirror.list.erb"),
mode => 0644,
owner => root,
group => root,
require => Package["apt-mirror"],
}
}

View file

@ -0,0 +1,23 @@
############# config ##################
#
# set base_path /var/spool/apt-mirror
#
# set mirror_path $base_path/mirror
# set skel_path $base_path/skel
# set var_path $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads <%= aptmirror_threads %>
set _tilde 0
#
############# end config ##############
<% aptmirror_list.each do |os| -%>
deb <%= aptmirror_server %> <%= os %> main restricted universe multiverse
deb <%= aptmirror_server %> <%= os %>-security main restricted universe multiverse
deb <%= aptmirror_server %> <%= os %>-updates main restricted universe multiverse
<% end -%>
clean http://archive.ubuntu.com/ubuntu