diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-03-21 16:39:29 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-03-21 16:39:29 +0100 |
commit | 32f9d6f1c281236f7c98d2ce2b7ea4360ad55351 (patch) | |
tree | df2afc14ee66bccccc3bb2cd2c1615d9db61fd25 | |
parent | Introduce include_default. (diff) | |
download | pacman-master.tar.gz pacman-master.tar.xz |
-rw-r--r-- | manifests/init.pp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 9b65050..e992d7f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -6,7 +6,14 @@ # @param ilovecandy # It's a secret to everybody. # @param parallel_downloads -# @param mirrorlist +# @param mirrorlist_source +# Contents of default mirrorlist file. +# Mutually exclusive with $mirrorlist_content. +# @param mirrorlist_content +# Source url of default mirrorlist file. +# Mutually exclusive with $mirrorlist_source. +# @param mirrorlist_file +# Path to default mirrorlist file. # @param update # Should 'pacman -Sy' be run after changes to the configuration? # @param include_default @@ -16,7 +23,9 @@ class pacman ( String $conf_path = '/etc/pacman.conf', Boolean $ilovecandy = false, Optional[Integer] $parallel_downloads = undef, - String $mirrorlist = "puppet:///modules/${module_name}/mirrorlist", + Optional[String] $mirrorlist_source = undef, + Optional[String] $mirrorlist_content = undef, + String $mirrorlist_file = '/etc/pacman.d/mirrorlist', Boolean $update = false, Boolean $include_default = true, ) { @@ -56,14 +65,22 @@ class pacman ( purge => true, } - file { '/etc/pacman.d/mirrorlist': - backup => true, - source => $mirrorlist, + if $mirrorlist_source == undef and $mirrorlist_content == undef { + file { $mirrorlist_file: + backup => true, + source => "puppet:///modules/${module_name}/mirrorlist", + } + } else { + file { $mirrorlist_file: + backup => true, + source => $mirrorlist_source, + content => $mirrorlist_content, + } } if $include_default { pacman::repo { ['core', 'extra', 'community']: - include => '/etc/pacman.d/mirrorlist', + include => $mirrorlist_file, } } } |