28
|
1 |
# Puppet yum module |
|
2 |
|
|
3 |
This module provides helpful definitions for dealing with *yum*. |
|
4 |
|
|
5 |
### Requirements |
|
6 |
|
|
7 |
Module has been tested on: |
|
8 |
|
|
9 |
* Puppet 3.7.x |
|
10 |
* CentOS 6, 7 |
|
11 |
|
|
12 |
# Usage |
|
13 |
|
|
14 |
### yum |
|
15 |
|
|
16 |
Manage main Yum configuration. |
|
17 |
|
|
18 |
```puppet |
|
19 |
class { 'yum': |
|
20 |
keepcache => false|true, |
|
21 |
debuglevel => number, |
|
22 |
exactarch => false|true, |
|
23 |
obsoletes => false|true, |
|
24 |
gpgcheck => false|true, |
|
25 |
installonly_limit => number, |
|
26 |
keep_kernel_devel => false|true, |
|
27 |
} |
|
28 |
``` |
|
29 |
|
|
30 |
If `installonly_limit` is changed, purging of old kernel packages is triggered. |
|
31 |
|
|
32 |
### yum::config |
|
33 |
|
|
34 |
Manage yum.conf. |
|
35 |
|
|
36 |
```puppet |
|
37 |
yum::config { 'installonly_limit': |
|
38 |
ensure => 2, |
|
39 |
} |
|
40 |
|
|
41 |
yum::config { 'debuglevel': |
|
42 |
ensure => absent, |
|
43 |
} |
|
44 |
``` |
|
45 |
|
|
46 |
### yum::gpgkey |
|
47 |
|
|
48 |
Import/remove GPG RPM signing key. |
|
49 |
|
|
50 |
Key defined in recipe (inline): |
|
51 |
|
|
52 |
```puppet |
|
53 |
yum::gpgkey { '/etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-smoketest1': |
|
54 |
ensure => present, |
|
55 |
content => '-----BEGIN PGP PUBLIC KEY BLOCK----- |
|
56 |
... |
|
57 |
-----END PGP PUBLIC KEY BLOCK-----', |
|
58 |
} |
|
59 |
``` |
|
60 |
|
|
61 |
Key stored on Puppet fileserver: |
|
62 |
|
|
63 |
```puppet |
|
64 |
yum::gpgkey { '/etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org': |
|
65 |
ensure => present, |
|
66 |
source => 'puppet:///modules/elrepo/RPM-GPG-KEY-elrepo.org', |
|
67 |
} |
|
68 |
``` |
|
69 |
|
|
70 |
### yum::plugin |
|
71 |
|
|
72 |
Install or remove *yum* plugin: |
|
73 |
|
|
74 |
```puppet |
|
75 |
yum::plugin { 'versionlock': |
|
76 |
ensure => present, |
|
77 |
} |
|
78 |
``` |
|
79 |
|
|
80 |
### yum::versionlock |
|
81 |
|
|
82 |
Locks explicitly specified packages from updates. Package name must |
|
83 |
be precisely specified in format *`EPOCH:NAME-VERSION-RELEASE.ARCH`*. |
|
84 |
Wild card in package name is allowed or automatically appended, |
|
85 |
but be careful and always first check on target machine if your |
|
86 |
package is matched correctly! Following definitions create same |
|
87 |
configuration lines: |
|
88 |
|
|
89 |
```puppet |
|
90 |
yum::versionlock { '0:bash-4.1.2-9.el6_2.*': |
|
91 |
ensure => present, |
|
92 |
} |
|
93 |
|
|
94 |
yum::versionlock { '0:bash-4.1.2-9.el6_2.': |
|
95 |
ensure => present, |
|
96 |
} |
|
97 |
``` |
|
98 |
|
|
99 |
Correct name for installed package can be easily get by running e.g.: |
|
100 |
|
|
101 |
```bash |
|
102 |
$ rpm -q bash --qf '%|EPOCH?{%{EPOCH}}:{0}|:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' |
|
103 |
0:bash-4.2.45-5.el7_0.4.x86_64 |
|
104 |
``` |
|
105 |
|
|
106 |
### yum::group |
|
107 |
|
|
108 |
Install or remove *yum* package group: |
|
109 |
|
|
110 |
```puppet |
|
111 |
yum::group { 'X Window System': |
|
112 |
ensure => present, |
|
113 |
} |
|
114 |
``` |
|
115 |
|
|
116 |
*** |
|
117 |
|
|
118 |
CERIT Scientific Cloud, <support@cerit-sc.cz> |