Mercurial > repos > other > Puppet
comparison modules/apt/manifests/backports.pp @ 386:3fce34f642f1
Add a PHP module to handle platform differences
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 03 Jan 2022 17:09:39 +0000 |
parents | |
children | adf6fe9bbc17 |
comparison
equal
deleted
inserted
replaced
385:d9009f54eb23 | 386:3fce34f642f1 |
---|---|
1 # @summary Manages backports. | |
2 # | |
3 # @example Set up a backport source for Linux Mint qiana | |
4 # class { 'apt::backports': | |
5 # location => 'http://us.archive.ubuntu.com/ubuntu', | |
6 # release => 'trusty-backports', | |
7 # repos => 'main universe multiverse restricted', | |
8 # key => { | |
9 # id => '630239CC130E1A7FD81A27B140976EAF437D05B5', | |
10 # server => 'keyserver.ubuntu.com', | |
11 # }, | |
12 # } | |
13 # | |
14 # @param location | |
15 # Specifies an Apt repository containing the backports to manage. Valid options: a string containing a URL. Default value for Debian and | |
16 # Ubuntu varies: | |
17 # | |
18 # - Debian: 'http://deb.debian.org/debian' | |
19 # | |
20 # - Ubuntu: 'http://archive.ubuntu.com/ubuntu' | |
21 # | |
22 # @param release | |
23 # Specifies a distribution of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file. | |
24 # Default: on Debian and Ubuntu, `${facts['os']['distro']['codename']}-backports`. We recommend keeping this default, except on other operating | |
25 # systems. | |
26 # | |
27 # @param repos | |
28 # Specifies a component of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file. | |
29 # Default value for Debian and Ubuntu varies: | |
30 # | |
31 # - Debian: 'main contrib non-free' | |
32 # | |
33 # - Ubuntu: 'main universe multiverse restricted' | |
34 # | |
35 # @param key | |
36 # Specifies a key to authenticate the backports. Valid options: a string to be passed to the id parameter of the apt::key defined type, or a | |
37 # hash of parameter => value pairs to be passed to apt::key's id, server, content, source, and/or options parameters. Default value | |
38 # for Debian and Ubuntu varies: | |
39 # | |
40 # - Debian: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' | |
41 # | |
42 # - Ubuntu: '630239CC130E1A7FD81A27B140976EAF437D05B5' | |
43 # | |
44 # @param pin | |
45 # Specifies a pin priority for the backports. Valid options: a number or string to be passed to the `id` parameter of the `apt::pin` defined | |
46 # type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters. | |
47 # | |
48 # @param include | |
49 # Specifies whether to include 'deb' or 'src', or both. | |
50 # | |
51 class apt::backports ( | |
52 Optional[String] $location = undef, | |
53 Optional[String] $release = undef, | |
54 Optional[String] $repos = undef, | |
55 Optional[Variant[String, Hash]] $key = undef, | |
56 Optional[Variant[Integer, String, Hash]] $pin = 200, | |
57 Optional[Variant[Hash]] $include = {}, | |
58 ) { | |
59 include apt | |
60 | |
61 if $location { | |
62 $_location = $location | |
63 } | |
64 if $release { | |
65 $_release = $release | |
66 } | |
67 if $repos { | |
68 $_repos = $repos | |
69 } | |
70 if $key { | |
71 $_key = $key | |
72 } | |
73 if (!($facts['os']['name'] == 'Debian' or $facts['os']['name'] == 'Ubuntu')) { | |
74 unless $location and $release and $repos and $key { | |
75 fail('If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key') | |
76 } | |
77 } | |
78 unless $location { | |
79 $_location = $::apt::backports['location'] | |
80 } | |
81 unless $release { | |
82 $_release = "${facts['os']['distro']['codename']}-backports" | |
83 } | |
84 unless $repos { | |
85 $_repos = $::apt::backports['repos'] | |
86 } | |
87 unless $key { | |
88 $_key = $::apt::backports['key'] | |
89 } | |
90 | |
91 if $pin =~ Hash { | |
92 $_pin = $pin | |
93 } elsif $pin =~ Numeric or $pin =~ String { | |
94 # apt::source defaults to pinning to origin, but we should pin to release | |
95 # for backports | |
96 $_pin = { | |
97 'priority' => $pin, | |
98 'release' => $_release, | |
99 } | |
100 } else { | |
101 fail('pin must be either a string, number or hash') | |
102 } | |
103 | |
104 apt::source { 'backports': | |
105 location => $_location, | |
106 release => $_release, | |
107 repos => $_repos, | |
108 include => $include, | |
109 key => $_key, | |
110 pin => $_pin, | |
111 } | |
112 } |