diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-10 00:07:27 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-08-10 01:35:50 +0200 |
commit | 8ed6fb29b46bbac3f28adc0d0918a71b6a694322 (patch) | |
tree | aa3f985daf920bf8a765a652354a682804feee07 /modules | |
parent | 919d772aaa9bb6f298b1d0a433b6b32d15c0410f (diff) | |
download | Puppet-8ed6fb29b46bbac3f28adc0d0918a71b6a694322.tar.gz Puppet-8ed6fb29b46bbac3f28adc0d0918a71b6a694322.tar.zst Puppet-8ed6fb29b46bbac3f28adc0d0918a71b6a694322.zip |
Add pacman configuration
Diffstat (limited to 'modules')
-rw-r--r-- | modules/base_configuration/manifests/init.pp | 9 | ||||
-rw-r--r-- | modules/pacman/manifests/config.pp | 77 | ||||
-rw-r--r-- | modules/pacman/manifests/init.pp | 55 | ||||
-rw-r--r-- | modules/pacman/manifests/install.pp | 13 | ||||
-rw-r--r-- | modules/pacman/manifests/params.pp | 41 | ||||
-rw-r--r-- | modules/pacman/manifests/repo.pp | 21 | ||||
-rw-r--r-- | modules/pacman/templates/pacman.conf.customrepo.erb | 6 | ||||
-rw-r--r-- | modules/pacman/templates/pacman.conf.main.erb | 103 | ||||
-rw-r--r-- | modules/pacman/templates/pacman.conf.repo.erb | 15 |
9 files changed, 340 insertions, 0 deletions
diff --git a/modules/base_configuration/manifests/init.pp b/modules/base_configuration/manifests/init.pp index 4c6ca1e..dca17b3 100644 --- a/modules/base_configuration/manifests/init.pp +++ b/modules/base_configuration/manifests/init.pp | |||
@@ -49,4 +49,13 @@ class base_configuration ( | |||
49 | 'Subsystem' => 'sftp /usr/lib/openssh/sftp-server', | 49 | 'Subsystem' => 'sftp /usr/lib/openssh/sftp-server', |
50 | } | 50 | } |
51 | } | 51 | } |
52 | |||
53 | class { 'pacman': | ||
54 | color => true, | ||
55 | } | ||
56 | |||
57 | pacman::repo { 'multilib': | ||
58 | order => 15, | ||
59 | include => '/etc/pacman.d/mirrorlist' | ||
60 | } | ||
52 | } | 61 | } |
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 | # | ||
16 | class 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 | # | ||
16 | class 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 | ||
45 | pacman::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 | # | ||
5 | class 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 | # | ||
3 | class 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. | ||
4 | define 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 | } | ||
diff --git a/modules/pacman/templates/pacman.conf.customrepo.erb b/modules/pacman/templates/pacman.conf.customrepo.erb new file mode 100644 index 0000000..91e66fe --- /dev/null +++ b/modules/pacman/templates/pacman.conf.customrepo.erb | |||
@@ -0,0 +1,6 @@ | |||
1 | |||
2 | # An example of a custom package repository. See the pacman manpage for | ||
3 | # tips on creating your own repositories. | ||
4 | #[custom] | ||
5 | #SigLevel = Optional TrustAll | ||
6 | #Server = file:///home/custompkgs | ||
diff --git a/modules/pacman/templates/pacman.conf.main.erb b/modules/pacman/templates/pacman.conf.main.erb new file mode 100644 index 0000000..2c2df5b --- /dev/null +++ b/modules/pacman/templates/pacman.conf.main.erb | |||
@@ -0,0 +1,103 @@ | |||
1 | # | ||
2 | # /etc/pacman.conf | ||
3 | # | ||
4 | # See the pacman.conf(5) manpage for option and repository directives | ||
5 | |||
6 | # | ||
7 | # GENERAL OPTIONS | ||
8 | # | ||
9 | [options] | ||
10 | # The following paths are commented out with their default values listed. | ||
11 | # If you wish to use different paths, uncomment and update the paths. | ||
12 | #RootDir = / | ||
13 | RootDir = <%= @rootdir %> | ||
14 | |||
15 | #DBPath = /var/lib/pacman/ | ||
16 | DBPath = <%= @dbpath %> | ||
17 | |||
18 | #CacheDir = /var/cache/pacman/pkg/ | ||
19 | CacheDir = <%= @cachedir %> | ||
20 | |||
21 | #LogFile = /var/log/pacman.log | ||
22 | LogFile = <%= @logfile %> | ||
23 | |||
24 | #GPGDir = /etc/pacman.d/gnupg/ | ||
25 | GPGDir = <%= @gpgdir %> | ||
26 | |||
27 | #HoldPkg = pacman glibc | ||
28 | HoldPkg = <%= @holdpkg %> | ||
29 | |||
30 | #XferCommand = /usr/bin/curl -C - -f %u > %o | ||
31 | #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u | ||
32 | XferCommand = <%= @xfercommand %> | ||
33 | |||
34 | #CleanMethod = KeepInstalled | ||
35 | CleanMethod = <%= @cleanmethod %> | ||
36 | |||
37 | #UseDelta = 0.7 | ||
38 | UseDelta = <%= @usedelta %> | ||
39 | |||
40 | #Architecture = auto | ||
41 | Architecture = <%= @architecture %> | ||
42 | |||
43 | # Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup | ||
44 | IgnorePkg = <%= @ignorepkg %> | ||
45 | IgnoreGroup = <%= @ignoregroup %> | ||
46 | |||
47 | NoUpgrade = <%= @noupgrade %> | ||
48 | NoExtract = <%= @noextract %> | ||
49 | |||
50 | # Misc options | ||
51 | #UseSyslog | ||
52 | <% if @usesyslog -%> | ||
53 | UseSyslog | ||
54 | <% end -%> | ||
55 | #color | ||
56 | <% if @color -%> | ||
57 | Color | ||
58 | <% end -%> | ||
59 | #TotalDownload | ||
60 | <% if @totaldownload -%> | ||
61 | TotalDownload | ||
62 | <% end -%> | ||
63 | #CheckSpace | ||
64 | <% if @checkspace -%> | ||
65 | CheckSpace | ||
66 | <% end -%> | ||
67 | #VerbosePkgLists | ||
68 | <% if @verbosepkglist -%> | ||
69 | VerbosePkgLists | ||
70 | <% end -%> | ||
71 | |||
72 | # By default, pacman accepts packages signed by keys that its local keyring | ||
73 | # trusts (see pacman-key and its man page), as well as unsigned packages. | ||
74 | SigLevel = <%= @mainsiglevel %> | ||
75 | LocalFileSigLevel = <%= @localfilesiglevel %> | ||
76 | RemoteFileSigLevel = <%= @remotefilesiglevel %> | ||
77 | |||
78 | # NOTE: You must run `pacman-key --init` before first using pacman; the local | ||
79 | # keyring can then be populated with the keys of all official Arch Linux | ||
80 | # packagers with `pacman-key --populate archlinux`. | ||
81 | |||
82 | # | ||
83 | # REPOSITORIES | ||
84 | # - can be defined here or included from another file | ||
85 | # - pacman will search repositories in the order defined here | ||
86 | # - local/custom mirrors can be added here or in separate files | ||
87 | # - repositories listed first will take precedence when packages | ||
88 | # have identical names, regardless of version number | ||
89 | # - URLs will have $repo replaced by the name of the current repo | ||
90 | # - URLs will have $arch replaced by the name of the architecture | ||
91 | # | ||
92 | # Repository entries are of the format: | ||
93 | # [repo-name] | ||
94 | # Server = ServerName | ||
95 | # Include = IncludePath | ||
96 | # | ||
97 | # The header [repo-name] is crucial - it must be present and | ||
98 | # uncommented to enable the repo. | ||
99 | # | ||
100 | |||
101 | # The testing repositories are disabled by default. To enable, uncomment the | ||
102 | # repo name header and Include lines. You can add preferred servers immediately | ||
103 | # after the header, and they will be used before the default mirrors. | ||
diff --git a/modules/pacman/templates/pacman.conf.repo.erb b/modules/pacman/templates/pacman.conf.repo.erb new file mode 100644 index 0000000..8038c47 --- /dev/null +++ b/modules/pacman/templates/pacman.conf.repo.erb | |||
@@ -0,0 +1,15 @@ | |||
1 | |||
2 | [<%= @name %>] | ||
3 | <% if @description -%> | ||
4 | # Description: <%= @description %> | ||
5 | <% end -%> | ||
6 | # Order: <%= @order %> | ||
7 | <%if @siglevel -%> | ||
8 | SigLevel = <%= @siglevel %> | ||
9 | <% end -%> | ||
10 | <%if @server -%> | ||
11 | Server = <%= @server %> | ||
12 | <% end -%> | ||
13 | <%if @include -%> | ||
14 | Include = <%= @include%> | ||
15 | <% end -%> | ||