[submodule "modules/puppetlabs_concat"]
path = modules/concat
url = https://github.com/puppetlabs/puppetlabs-concat.git
+[submodule "modules/pacman"]
+ path = modules/pacman
+ url = https://github.com/aboe76/puppet-pacman.git
'Subsystem' => 'sftp /usr/lib/openssh/sftp-server',
}
}
+
+ class { 'pacman':
+ color => true,
+ }
+
+ pacman::repo { 'multilib':
+ order => 15,
+ include => '/etc/pacman.d/mirrorlist'
+ }
}
--- /dev/null
+# Class: pacman::config
+#
+# This module manages pacman config file
+#
+# Parameters:
+# $config = '/etc/pacman.conf'
+#
+# Actions:
+# with the use of concat it will build a pacman config file
+# which is extendable with the class pacman::repo
+#
+# Requires: see Modulefile
+#
+# Sample Usage:
+#
+class pacman::config (
+ $config = $pacman::config,
+ # pacman config options
+ $rootdir = $pacman::rootdir,
+ $dbpath = $pacman::dbpath,
+ $cachedir = $pacman::cachedir,
+ $logfile = $pacman::logfile,
+ $gpgdir = $pacman::gpgdir,
+ $holdpkg = $pacman::holdpkg,
+ $xfercommand = $pacman::xfercommand,
+ $cleanmethod = $pacman::cleanmethod,
+ $usedelta = $pacman::usedelta,
+ $architecture = $pacman::architecture,
+ # pacman package options
+ $ignorepkg = $pacman::ignorepkg,
+ $noupgrade = $pacman::noupgrade,
+ $noextract = $pacman::noextract,
+ # pacman misc options
+ $usesyslog = $pacman::usesyslog,
+ $color = $pacman::color,
+ $totaldownload = $pacman::totaldownload,
+ $checkspace = $pacman::checkspace,
+ $verbosepkglist = $pacman::verbosepkglist,
+ # pacman sec options
+ $mainsiglevel = $pacman::mainsiglevel,
+ $localfilesiglevel = $pacman::localfilesiglevel,
+ $remotefilesiglevel = $pacman::remotefilesiglevel,) inherits pacman {
+ concat { $config:
+ ensure_newline => true,
+ owner => 0,
+ group => 0,
+ mode => '0644',
+ }
+
+ concat::fragment { 'main':
+ target => $config,
+ content => template('pacman/pacman.conf.main.erb'),
+ order => 00
+ }
+
+ pacman::repo { 'core':
+ include => '/etc/pacman.d/mirrorlist',
+ order => 10,
+ }
+
+ pacman::repo { 'extra':
+ include => '/etc/pacman.d/mirrorlist',
+ order => 11,
+ }
+
+ pacman::repo { 'community':
+ include => '/etc/pacman.d/mirrorlist',
+ order => 12,
+ }
+
+ concat::fragment { 'custom':
+ target => $config,
+ content => template('pacman/pacman.conf.customrepo.erb'),
+ order => 15
+ }
+
+}
--- /dev/null
+# Class: pacman
+#
+# This module manages pacman
+#
+# Parameters:
+# $config = '/etc/pacman.conf'
+# $config_template = 'pacman/pacman.conf.archlinux.erb'
+# $package_name = ['pacman']
+#
+# Actions:
+#
+# Requires: see Modulefile
+#
+# Sample Usage:
+#
+class pacman (
+ $config = $pacman::params::config,
+ $package_ensure = $pacman::params::package_ensure,
+ $package_name = $pacman::params::package_name,
+ # pacman config options
+ $rootdir = $pacman::params::rootdir,
+ $dbpath = $pacman::params::dbpath,
+ $cachedir = $pacman::params::cachedir,
+ $logfile = $pacman::params::logfile,
+ $gpgdir = $pacman::params::gpgdir,
+ $holdpkg = $pacman::params::holdpkg,
+ $xfercommand = $pacman::params::xfercommand,
+ $cleanmethod = $pacman::params::cleanmethod,
+ $usedelta = $pacman::params::usedelta,
+ $architecture = $pacman::params::architecture,
+ # pacman package options
+ $ignorepkg = $pacman::params::ignorepkg,
+ $noupgrade = $pacman::params::noupgrade,
+ $noextract = $pacman::params::noextract,
+ # pacman misc options
+ $usesyslog = $pacman::params::usesyslog,
+ $color = $pacman::params::color,
+ $totaldownload = $pacman::params::totaldownload,
+ $checkspace = $pacman::params::checkspace,
+ $verbosepkglist = $pacman::params::verbosepkglist,
+ # pacman sec options
+ $mainsiglevel = $pacman::params::mainsiglevel,
+ $localfilesiglevel = $pacman::params::localfilesiglevel,
+ $remotefilesiglevel = $pacman::params::remotefilesiglevel,) inherits
+pacman::params {
+ include '::pacman::install'
+ include '::pacman::config'
+
+ anchor { 'pacman::begin': }
+
+ anchor { 'pacman::end': }
+
+ Anchor['pacman::begin'] -> Class['::pacman::install'] -> Class['::pacman::config'
+ ] -> Anchor['pacman::end']
+}
--- /dev/null
+# Class: pacman::install
+#
+# This class ensures pacman is installed
+#
+class pacman::install (
+ $package_ensure = $pacman::package_ensure,
+ $package_name = $pacman::package_name,) inherits pacman {
+ package { 'pacman':
+ ensure => $package_ensure,
+ name => $package_name,
+ }
+
+}
--- /dev/null
+# Class: pacman::params
+#
+class pacman::params {
+ case $::osfamily {
+ 'Archlinux' : {
+ $package_ensure = 'present'
+ $package_name = 'pacman'
+ $config = '/etc/pacman.conf'
+ # pacman config options
+ $rootdir = '/'
+ $dbpath = '/var/lib/pacman'
+ $cachedir = '/var/cache/pacman/pkg'
+ $logfile = '/var/log/pacman.log'
+ $gpgdir = '/etc/pacman.d/gnupg/'
+ $holdpkg = 'pacman glibc'
+ $xfercommand = '/usr/bin/curl -C - -f %u > %o'
+ $cleanmethod = 'KeepInstalled'
+ $usedelta = '0.7'
+ $architecture = 'auto'
+ # pacman package options
+ $ignorepkg = undef
+ $noupgrade = undef
+ $noextract = undef
+ # pacman misc options
+ $usesyslog = false
+ $color = false
+ $totaldownload = false
+ $checkspace = true
+ $verbosepkglist = false
+ # pacman sec options
+ $mainsiglevel = 'Required DatabaseOptional'
+ $localfilesiglevel = 'Optional'
+ $remotefilesiglevel = 'Required'
+ }
+
+ default : {
+ fail("The ${module_name} module is not supported
+ on an ${::osfamily} based system.")
+ }
+ }
+}
--- /dev/null
+# This resource manages an individual repo's that applies to the file defined in
+# $target. See README.md for more details.
+# always order from 100 and increase.
+define pacman::repo (
+ $server = undef,
+ $include = undef,
+ $description = undef,
+ $siglevel = undef,
+ $order = '100',
+ # Needed for testing primarily, support for multiple files is not really
+ # working.
+ $target = $pacman::config::config) {
+ # Create a rule fragment
+ $fragname = "repo_${name}"
+
+ concat::fragment { $fragname:
+ target => $target,
+ content => template('pacman/pacman.conf.repo.erb'),
+ order => $order,
+ }
+}
--- /dev/null
+
+# An example of a custom package repository. See the pacman manpage for
+# tips on creating your own repositories.
+#[custom]
+#SigLevel = Optional TrustAll
+#Server = file:///home/custompkgs
--- /dev/null
+#
+# /etc/pacman.conf
+#
+# See the pacman.conf(5) manpage for option and repository directives
+
+#
+# GENERAL OPTIONS
+#
+[options]
+# The following paths are commented out with their default values listed.
+# If you wish to use different paths, uncomment and update the paths.
+#RootDir = /
+RootDir = <%= @rootdir %>
+
+#DBPath = /var/lib/pacman/
+DBPath = <%= @dbpath %>
+
+#CacheDir = /var/cache/pacman/pkg/
+CacheDir = <%= @cachedir %>
+
+#LogFile = /var/log/pacman.log
+LogFile = <%= @logfile %>
+
+#GPGDir = /etc/pacman.d/gnupg/
+GPGDir = <%= @gpgdir %>
+
+#HoldPkg = pacman glibc
+HoldPkg = <%= @holdpkg %>
+
+#XferCommand = /usr/bin/curl -C - -f %u > %o
+#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
+XferCommand = <%= @xfercommand %>
+
+#CleanMethod = KeepInstalled
+CleanMethod = <%= @cleanmethod %>
+
+#UseDelta = 0.7
+UseDelta = <%= @usedelta %>
+
+#Architecture = auto
+Architecture = <%= @architecture %>
+
+# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
+IgnorePkg = <%= @ignorepkg %>
+IgnoreGroup = <%= @ignoregroup %>
+
+NoUpgrade = <%= @noupgrade %>
+NoExtract = <%= @noextract %>
+
+# Misc options
+#UseSyslog
+<% if @usesyslog -%>
+UseSyslog
+<% end -%>
+#color
+<% if @color -%>
+Color
+<% end -%>
+#TotalDownload
+<% if @totaldownload -%>
+TotalDownload
+<% end -%>
+#CheckSpace
+<% if @checkspace -%>
+CheckSpace
+<% end -%>
+#VerbosePkgLists
+<% if @verbosepkglist -%>
+VerbosePkgLists
+<% end -%>
+
+# By default, pacman accepts packages signed by keys that its local keyring
+# trusts (see pacman-key and its man page), as well as unsigned packages.
+SigLevel = <%= @mainsiglevel %>
+LocalFileSigLevel = <%= @localfilesiglevel %>
+RemoteFileSigLevel = <%= @remotefilesiglevel %>
+
+# NOTE: You must run `pacman-key --init` before first using pacman; the local
+# keyring can then be populated with the keys of all official Arch Linux
+# packagers with `pacman-key --populate archlinux`.
+
+#
+# REPOSITORIES
+# - can be defined here or included from another file
+# - pacman will search repositories in the order defined here
+# - local/custom mirrors can be added here or in separate files
+# - repositories listed first will take precedence when packages
+# have identical names, regardless of version number
+# - URLs will have $repo replaced by the name of the current repo
+# - URLs will have $arch replaced by the name of the architecture
+#
+# Repository entries are of the format:
+# [repo-name]
+# Server = ServerName
+# Include = IncludePath
+#
+# The header [repo-name] is crucial - it must be present and
+# uncommented to enable the repo.
+#
+
+# The testing repositories are disabled by default. To enable, uncomment the
+# repo name header and Include lines. You can add preferred servers immediately
+# after the header, and they will be used before the default mirrors.
--- /dev/null
+
+[<%= @name %>]
+<% if @description -%>
+# Description: <%= @description %>
+<% end -%>
+# Order: <%= @order %>
+<%if @siglevel -%>
+SigLevel = <%= @siglevel %>
+<% end -%>
+<%if @server -%>
+Server = <%= @server %>
+<% end -%>
+<%if @include -%>
+Include = <%= @include%>
+<% end -%>