aboutsummaryrefslogtreecommitdiff
path: root/modules/pacman/manifests
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-10 00:07:27 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2016-08-10 01:35:50 +0200
commit8ed6fb29b46bbac3f28adc0d0918a71b6a694322 (patch)
treeaa3f985daf920bf8a765a652354a682804feee07 /modules/pacman/manifests
parent919d772aaa9bb6f298b1d0a433b6b32d15c0410f (diff)
downloadPuppet-8ed6fb29b46bbac3f28adc0d0918a71b6a694322.tar.gz
Puppet-8ed6fb29b46bbac3f28adc0d0918a71b6a694322.tar.zst
Puppet-8ed6fb29b46bbac3f28adc0d0918a71b6a694322.zip
Add pacman configuration
Diffstat (limited to 'modules/pacman/manifests')
-rw-r--r--modules/pacman/manifests/config.pp77
-rw-r--r--modules/pacman/manifests/init.pp55
-rw-r--r--modules/pacman/manifests/install.pp13
-rw-r--r--modules/pacman/manifests/params.pp41
-rw-r--r--modules/pacman/manifests/repo.pp21
5 files changed, 207 insertions, 0 deletions
diff --git a/modules/pacman/manifests/config.pp b/modules/pacman/manifests/config.pp
new file mode 100644
index 0000000..9bd22be
--- /dev/null
+++ b/modules/pacman/manifests/config.pp
@@ -0,0 +1,77 @@
1# Class: pacman::config
2#
3# This module manages pacman config file
4#
5# Parameters:
6# $config = '/etc/pacman.conf'
7#
8# Actions:
9# with the use of concat it will build a pacman config file
10# which is extendable with the class pacman::repo
11#
12# Requires: see Modulefile
13#
14# Sample Usage:
15#
16class pacman::config (
17 $config = $pacman::config,
18 # pacman config options
19 $rootdir = $pacman::rootdir,
20 $dbpath = $pacman::dbpath,
21 $cachedir = $pacman::cachedir,
22 $logfile = $pacman::logfile,
23 $gpgdir = $pacman::gpgdir,
24 $holdpkg = $pacman::holdpkg,
25 $xfercommand = $pacman::xfercommand,
26 $cleanmethod = $pacman::cleanmethod,
27 $usedelta = $pacman::usedelta,
28 $architecture = $pacman::architecture,
29 # pacman package options
30 $ignorepkg = $pacman::ignorepkg,
31 $noupgrade = $pacman::noupgrade,
32 $noextract = $pacman::noextract,
33 # pacman misc options
34 $usesyslog = $pacman::usesyslog,
35 $color = $pacman::color,
36 $totaldownload = $pacman::totaldownload,
37 $checkspace = $pacman::checkspace,
38 $verbosepkglist = $pacman::verbosepkglist,
39 # pacman sec options
40 $mainsiglevel = $pacman::mainsiglevel,
41 $localfilesiglevel = $pacman::localfilesiglevel,
42 $remotefilesiglevel = $pacman::remotefilesiglevel,) inherits pacman {
43 concat { $config:
44 ensure_newline => true,
45 owner => 0,
46 group => 0,
47 mode => '0644',
48 }
49
50 concat::fragment { 'main':
51 target => $config,
52 content => template('pacman/pacman.conf.main.erb'),
53 order => 00
54 }
55
56 pacman::repo { 'core':
57 include => '/etc/pacman.d/mirrorlist',
58 order => 10,
59 }
60
61 pacman::repo { 'extra':
62 include => '/etc/pacman.d/mirrorlist',
63 order => 11,
64 }
65
66 pacman::repo { 'community':
67 include => '/etc/pacman.d/mirrorlist',
68 order => 12,
69 }
70
71 concat::fragment { 'custom':
72 target => $config,
73 content => template('pacman/pacman.conf.customrepo.erb'),
74 order => 15
75 }
76
77}
diff --git a/modules/pacman/manifests/init.pp b/modules/pacman/manifests/init.pp
new file mode 100644
index 0000000..731f371
--- /dev/null
+++ b/modules/pacman/manifests/init.pp
@@ -0,0 +1,55 @@
1# Class: pacman
2#
3# This module manages pacman
4#
5# Parameters:
6# $config = '/etc/pacman.conf'
7# $config_template = 'pacman/pacman.conf.archlinux.erb'
8# $package_name = ['pacman']
9#
10# Actions:
11#
12# Requires: see Modulefile
13#
14# Sample Usage:
15#
16class pacman (
17 $config = $pacman::params::config,
18 $package_ensure = $pacman::params::package_ensure,
19 $package_name = $pacman::params::package_name,
20 # pacman config options
21 $rootdir = $pacman::params::rootdir,
22 $dbpath = $pacman::params::dbpath,
23 $cachedir = $pacman::params::cachedir,
24 $logfile = $pacman::params::logfile,
25 $gpgdir = $pacman::params::gpgdir,
26 $holdpkg = $pacman::params::holdpkg,
27 $xfercommand = $pacman::params::xfercommand,
28 $cleanmethod = $pacman::params::cleanmethod,
29 $usedelta = $pacman::params::usedelta,
30 $architecture = $pacman::params::architecture,
31 # pacman package options
32 $ignorepkg = $pacman::params::ignorepkg,
33 $noupgrade = $pacman::params::noupgrade,
34 $noextract = $pacman::params::noextract,
35 # pacman misc options
36 $usesyslog = $pacman::params::usesyslog,
37 $color = $pacman::params::color,
38 $totaldownload = $pacman::params::totaldownload,
39 $checkspace = $pacman::params::checkspace,
40 $verbosepkglist = $pacman::params::verbosepkglist,
41 # pacman sec options
42 $mainsiglevel = $pacman::params::mainsiglevel,
43 $localfilesiglevel = $pacman::params::localfilesiglevel,
44 $remotefilesiglevel = $pacman::params::remotefilesiglevel,) inherits
45pacman::params {
46 include '::pacman::install'
47 include '::pacman::config'
48
49 anchor { 'pacman::begin': }
50
51 anchor { 'pacman::end': }
52
53 Anchor['pacman::begin'] -> Class['::pacman::install'] -> Class['::pacman::config'
54 ] -> Anchor['pacman::end']
55}
diff --git a/modules/pacman/manifests/install.pp b/modules/pacman/manifests/install.pp
new file mode 100644
index 0000000..02b3128
--- /dev/null
+++ b/modules/pacman/manifests/install.pp
@@ -0,0 +1,13 @@
1# Class: pacman::install
2#
3# This class ensures pacman is installed
4#
5class pacman::install (
6 $package_ensure = $pacman::package_ensure,
7 $package_name = $pacman::package_name,) inherits pacman {
8 package { 'pacman':
9 ensure => $package_ensure,
10 name => $package_name,
11 }
12
13}
diff --git a/modules/pacman/manifests/params.pp b/modules/pacman/manifests/params.pp
new file mode 100644
index 0000000..b8b9e1c
--- /dev/null
+++ b/modules/pacman/manifests/params.pp
@@ -0,0 +1,41 @@
1# Class: pacman::params
2#
3class pacman::params {
4 case $::osfamily {
5 'Archlinux' : {
6 $package_ensure = 'present'
7 $package_name = 'pacman'
8 $config = '/etc/pacman.conf'
9 # pacman config options
10 $rootdir = '/'
11 $dbpath = '/var/lib/pacman'
12 $cachedir = '/var/cache/pacman/pkg'
13 $logfile = '/var/log/pacman.log'
14 $gpgdir = '/etc/pacman.d/gnupg/'
15 $holdpkg = 'pacman glibc'
16 $xfercommand = '/usr/bin/curl -C - -f %u > %o'
17 $cleanmethod = 'KeepInstalled'
18 $usedelta = '0.7'
19 $architecture = 'auto'
20 # pacman package options
21 $ignorepkg = undef
22 $noupgrade = undef
23 $noextract = undef
24 # pacman misc options
25 $usesyslog = false
26 $color = false
27 $totaldownload = false
28 $checkspace = true
29 $verbosepkglist = false
30 # pacman sec options
31 $mainsiglevel = 'Required DatabaseOptional'
32 $localfilesiglevel = 'Optional'
33 $remotefilesiglevel = 'Required'
34 }
35
36 default : {
37 fail("The ${module_name} module is not supported
38 on an ${::osfamily} based system.")
39 }
40 }
41}
diff --git a/modules/pacman/manifests/repo.pp b/modules/pacman/manifests/repo.pp
new file mode 100644
index 0000000..02dc4ec
--- /dev/null
+++ b/modules/pacman/manifests/repo.pp
@@ -0,0 +1,21 @@
1# This resource manages an individual repo's that applies to the file defined in
2# $target. See README.md for more details.
3# always order from 100 and increase.
4define pacman::repo (
5 $server = undef,
6 $include = undef,
7 $description = undef,
8 $siglevel = undef,
9 $order = '100',
10 # Needed for testing primarily, support for multiple files is not really
11 # working.
12 $target = $pacman::config::config) {
13 # Create a rule fragment
14 $fragname = "repo_${name}"
15
16 concat::fragment { $fragname:
17 target => $target,
18 content => template('pacman/pacman.conf.repo.erb'),
19 order => $order,
20 }
21}