cookbook 'yum', '~> 4.1.0', :supermarket
Configures various yum components on Red Hat-like systems
cookbook 'yum', '~> 4.1.0'
knife cookbook site install yum
knife cookbook site download yum
The Yum cookbook exposes the
yum_repository resources that allows a user to both control global behavior and make individual Yum repositories available for use. These resources aim to allow the user to configure all options listed in the
yum.conf man page, found at http://linux.die.net/man/5/yum.conf
- RHEL/CentOS and derivatives
- Chef 12+
This resource manages a yum repository configuration file at /etc/yum.repos.d/
repositoryid.repo. When the file needs to be repaired, it calls yum-makecache so packages in the repo become available to the next resource.
# add the Zenoss repository yum_repository 'zenoss' do description "Zenoss Stable repo" baseurl "http://dev.zenoss.com/yum/stable/" gpgkey 'http://dev.zenoss.com/yum/RPM-GPG-KEY-zenoss' action :create end # add some internal company repo yum_repository 'OurCo' do description 'OurCo yum repository' mirrorlist 'http://artifacts.ourco.org/mirrorlist?repo=ourco-6&arch=$basearch' gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-6' action :create end
# delete CentOS-Media repo yum_repository 'CentOS-Media' do action :delete end
:create- creates a repository file and builds the repository listing
:delete- deletes the repository file
:makecache- update yum cache
baseurl- Must be a URL to the directory where the yum repository's 'repodata' directory lives. Can be an http://, ftp:// or file:// URL. You can specify multiple URLs in one baseurl statement.
cost- relative cost of accessing this repository. Useful for weighing one repo's packages as greater/less than any other. defaults to 1000
clean_metadata- Run "yum clean metadata REPONAME" during repository creation. defaults to true.
description- Maps to the 'name' parameter in a repository .conf. Descriptive name for the repository channel. This directive must be specified.
false. This tells yum whether or not use this repository.
false. Determines whether yum will allow the use of package groups for this repository. Default is
true(package groups are allowed).
exclude- List of packages to exclude from updates or installs. This should be a space separated list in a single string. Shell globs using wildcards (eg. * and ?) are allowed.
failovermethod- Either 'roundrobin' or 'priority'.
false. This tells yum whether or not it should perform a GPG signature check on packages. When this is set in the [main] section it sets the default for all repositories. The default is
gpgkey- A URL pointing to the ASCII-armored GPG key file for the repository. This option is used if yum needs a public key to verify a package and the required key hasn't been imported into the RPM database. If this option is set, yum will automatically import the key from the specified URL.
http_caching- Either 'all', 'packages', or 'none'. Determines how upstream HTTP caches are instructed to handle any HTTP downloads that Yum does. Defaults to 'all'
includepkgs- Inverse of exclude. This is a list of packages you want to use from a repository. If this option lists only one package then that is all yum will ever see from the repository. Defaults to an empty list.
false. This tells yum whether or not HTTP/1.1 keepalive should be used with this repository.
make_cache- Optional, Default is
yum -q makecachewill not be ran
max_retries- Set the number of times any attempt to retrieve a file should retry before returning an error. Setting this to '0' makes yum try forever. Default is '10'.
metadata_expire- Time (in seconds) after which the metadata will expire. So that if the current metadata downloaded is less than this many seconds old then yum will not update the metadata against the repository. If you find that yum is not downloading information on updates as often as you would like lower the value of this option. You can also change from the default of using seconds to using days, hours or minutes by appending a d, h or m respectively. The default is 6 hours, to compliment yum-updatesd running once an hour. It's also possible to use the word "never", meaning that the metadata will never expire. Note that when using a metalink file the metalink must always be newer than the metadata for the repository, due to the validation, so this timeout also applies to the metalink file.
mirrorlist- Specifies a URL to a file containing a list of baseurls. This can be used instead of or with the baseurl option. Substitution variables, described below, can be used with this option. As a special hack is the mirrorlist URL contains the word "metalink" then the value of mirrorlist is copied to metalink (if metalink is not set)
mirror_expire- Time (in seconds) after which the mirrorlist locally cached will expire. If the current mirrorlist is less than this many seconds old then yum will not download another copy of the mirrorlist, it has the same extra format as metadata_expire. If you find that yum is not downloading the mirrorlists as often as you would like lower the value of this option.
mirrorlist_expire- alias for mirror_expire
mode- Permissions mode of .repo file on disk. Useful for scenarios where secrets are in the repo file. If set to '600', normal users will not be able to use yum search, yum info, etc. Defaults to '0644'
priority- When the yum-priorities plug-in is enabled, you set priorities on repository entries, where N is an integer from 1 to 99. The default priority for repositories is 99.
proxy- URL to the proxy server that yum should use.
proxy_username- username to use for proxy
proxy_password- password for this proxy
report_instanceid- Report instance ID when using Amazon Linux AMIs and repositories
repositoryid- Must be a unique name for each repository, one word. Defaults to name attribute.
sensitive- Optional, Default is
truethen content of repository file is hidden from chef run output.
source- Use a custom template source instead of the default one in the yum cookbook
sslcacert- Path to the directory containing the databases of the certificate authorities yum should use to verify SSL certificates. Defaults to none - uses system default
sslclientcert- Path to the SSL client certificate yum should use to connect to repos/remote sites Defaults to none.
sslclientkey- Path to the SSL client key yum should use to connect to repos/remote sites Defaults to none.
false. Determines if yum will verify SSL certificates/hosts. Defaults to
timeout- Number of seconds to wait for a connection before timing out. Defaults to 30 seconds. This may be too short of a time for extremely overloaded sites.
This renders a template with global yum configuration parameters. The default recipe uses it to render
/etc/yum.conf. It is flexible enough to be used in other scenarios, such as building RPMs in isolation by modifying
yum_globalconfig '/my/chroot/etc/yum.conf' do cachedir '/my/chroot/etc/yum.conf' keepcache 'yes' debuglevel '2' installroot '/my/chroot' action :create end
yum_globalconfig can take most of the same parameters as a
yum_repository, plus more, too numerous to describe here. Below are a few of the more commonly used ones. For a complete list, please consult the
yum.conf man page, found here: http://linux.die.net/man/5/yum.conf
cachedir- Directory where yum should store its cache and db files. The default is '/var/cache/yum'.
false. Determines whether or not yum keeps the cache of headers and packages after successful installation. Default is
debuglevel- Debug message output level. Practical range is 0-10. Default is '2'.
exclude- List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg. * and ?) are allowed.
installonlypkgs= List of package provides that should only ever be installed, never updated. Kernels in particular fall into this category. Defaults to kernel, kernel-bigmem, kernel-enterprise, kernel-smp, kernel-debug, kernel-unsupported, kernel-source, kernel-devel, kernel-PAE, kernel-PAE-debug.
logfile- Full directory and file name for where yum should write its log file.
false. Set to
trueto make 'yum update' only update the architectures of packages that you have installed. ie: with this enabled yum will not install an i686 package to update an x86_64 package. Default is
false. This tells yum whether or not it should perform a GPG signature check on the packages gotten from this repository.
yum_globalconfig[/etc/yum.conf]with values found in node attributes at
dnf_yum_compat- Installs the yum package using dnf on Fedora systems to provide support for the package resource in recipes. This is necessary as Chef does not yet (as of Q4 2015) have native support for DNF. This recipe should be 1st on a Fedora runlist
The following attributes are set by default
default['yum']['main']['cachedir'] = '/var/cache/yum/$basearch/$releasever' default['yum']['main']['keepcache'] = false default['yum']['main']['debuglevel'] = nil default['yum']['main']['exclude'] = nil default['yum']['main']['logfile'] = '/var/log/yum.log' default['yum']['main']['exactarch'] = nil default['yum']['main']['obsoletes'] = nil default['yum']['main']['installonly_limit'] = nil default['yum']['main']['installonlypkgs'] = nil default['yum']['main']['installroot'] = nil
For Amazon platform nodes,
default['yum']['main']['releasever'] = 'latest'
Recipes from older versions of this cookbook have been moved individual cookbooks. Recipes for managing platform yum configurations and installing specific repositories can be found in one (or more!) of the following cookbook.
depends 'yum' in your metadata.rb to gain access to the yum_repository resource.
License & Authors
- Author:: Eric G. Wolfe
- Author:: Matt Ray (firstname.lastname@example.org)
- Author:: Joshua Timberman (email@example.com)
- Author:: Sean OMeara (firstname.lastname@example.org)
Copyright:: 2011 Eric G. Wolfe Copyright:: 2013-2016 Chef Software, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This cookbook has no specified dependencies.
yum Cookbook CHANGELOG
This file is used to list changes made in each version of the yum cookbook.
- Purge yum cache before removing a repo not after
- Remove support for Chef 11
- Add deprecation warning for add/remove actions, which were replaced with create/delete in Yum 3.0
- Remove support for Chef 10
- Fixing baseurl to support multiple urls
- Modify releasever attribute for Amazon to match Amazon's default policy for releasever
- Install yum at compile time in the dnf compatibility recipe
- Add IBM zlinux as a supported platform in the metadata
- Use cookstyle instead of rubocop to provide a consistent linting experience
- Add a new sensitive attribute to the repository resource so prevent writing the diff of the config to Chef output / logs
- Update testing dependencies and remove the Guardfile / Guard dependencies
- Added dnf_yum_compat recipe to ensure yum is installed on Fedora systems for Chef package resource compatibility. This will no longer be necessary when native dnf package support ships in chef-client.
- # 141 - Replace clean_headers with clean_metadata
- Fixing up Chef13 deprecation warnings
- adding clean_headers boolean property to yum_resource
- restoring Chef 10 backwards compat for the sake of ChefSpec
- (unique resource names needed to avoid cloning)
- Fixing localpkg_gpgcheck values
- # 135 - reverting "yum clean headers" as it breaks dnf compat
- Adding deltarpm toggle
- Cleaning 'headers' rather than 'all'
- Normalizing sslverify option rendering behavior
- Setting default value on the resource to nil
- Explictly setting string to render in template if value is supplied
- Behavior should default to "True", per man page
- Adding -y to makecache, to import key when repo_gpgcheck = true.
- Accepting Integer value for max_retries
- Executing yum clean before makecache
- Adding repo_gpgcheck
- Adding "yum clean" before "yum makecache" in yum_repository :create
- Adding why_run support to yum_globalconfig
- Changing tolerant config line to stringified integer
- Adding reposdir to globalconfig template
- Fixing redhat-release detection for Redhat 7
- Reverting management of ca-certificates because EL5 was broken
- Adding management of ca-certificates package to yum_repository provider
- Run yum-makecache only_if new_resource.enabled
- Allow setting of reposdir in global yum config and man page
- Change default 'obsoletes' behavior to match yum defaults
- Dynamically generate the new_resource attributes
- Fix globalconfig resource param for http_caching
- Fix issue with sslverify if set to false
- Add fancy badges
- Adding tuning attributes for all supported resource parameters
- Adding options hash parameter
- Adding (real) rhel-6.5 and centos-7.0 to test-kitchen coverage
- Updating regex for mirror_expire and mirrorlist_expire to include /\d+[mhd]$/
- Updating README so keepcache reflects reality (defaults to false)
- Changing 'obsoletes' behavior in globalconfig resource to match
- default behavior. (now defaults to nil, yum defaults to false)
- Adding makecache action to repository resource
- Adding mode parameter to repository resource. Defaults to '0644'.
- # 82 - Adding a makecache parameter
77 - Parameter default to be Trueclass instead of "1"
78 - add releasever parameter
- [COOK-4510] - Adding username and password parameters to node attributes
- [COOK-4518] - Fix Scientific Linux distroverpkg
- [COOK-4463] - support multiple GPG keys
- [COOK-4364] - yum_repository delete action fails
- [COOK-4417] Expand test harness to encompass 32-bit boxes
Fixing bugs around :delete action and cache clean Fixing specs to cover :remove and :delete aliasing properly Adding Travis-ci build matrix bits
- Updating testing harness for integration testing on Travis-ci
- Adding TESTING.md and Guardfile
- PR #67 - Add skip_if_unvailable repository option
- PR #64 - Fix validation of 'metadata_expire' option to match documentation
- [COOK-3591] - removing node.name from repo template rendering
- [COOK-4275] - Enhancements to yum cookbook
- Adding full spec coverage
- Adding support for custom source template to yum_repository
Fixing typo in default.rb. yum_globalconfig now passes proxy attribute correctly.
Updating default.rb to consume node['yum']['main']['proxy']
- COOK-4156 - yum cookbook creates a yum.conf with "cachefir" directive
Updating globalconfig provider for Chef 10 compatability
3.0.0 Major rewrite with breaking changes. Recipes broken out into individual cookbooks yum_key resource has been removed yum_repository resource now takes gpgkey as a URL directly yum_repository actions have been reduced to :create and :delete 'name' has been changed to repositoryid to avoid ambiguity chefspec test coverage gpgcheck is set to 'true' by default and must be explicitly disabled
Reverting to Ruby 1.8 hash syntax.
[COOK-3275] LWRP repository.rb :add method fails to create yum repo in some cases which causes :update to fail Amazon rhel
- [COOK-3025] - Allow per-repo proxy definitions
- COOK-3689 - Fix warnings about resource cloning
- COOK-3574 - Add missing "description" field in metadata
- COOK-3145 - Use correct download URL for epel
- [COOK-2924]: Yum should allow type setting in repo file
- [COOK-2360]: last commit to
yum_repositorychanges previous behaviour
- [COOK-3015]: Yum cookbook test minitest to fail
- [COOK-2741]: yum::elrepo
- [COOK-2946]: update tests, test kitchen support in yum cookbook
- [COOK-2639]: Yum cookbook - epel - always assumes url is a mirror list
- [COOK-2663]: Yum should allow metadata_expire setting in repo file
- [COOK-2751]: Update yum.ius_release version to 1.0-11
- [COOK-2189] - yum::ius failed on install (caused from rpm dependency)
- [COOK-2196] - Make includepkgs and exclude configurable for each repos
- [COOK-2244] - Allow configuring caching using attributes
- [COOK-2399] - yum cookbook LWRPs fail FoodCritic
- [COOK-2519] - Add priority option to Yum repo files
- [COOK-2593] - allow integer or string for yum priority
- [COOK-2643] - don't use conditional attribute for
- [COOK-2045] - add remi repository recipe
- [COOK-2121] - add
- [COOK-2037] - minor style fixes
- [COOK-2038] - updated README
- [COOK-1908] - unable to install repoforge on CentOS 6 32 bit
- [COOK-1758] - Add default action for repository resource
This version changes the behavior of the EPEL recipe (most commonly used in other Chef cookbooks) on Amazon, and removes an attribute,
node['yum']['epel_release']. See the README for details.
- [COOK-1772] - Simplify management of EPEL with LWRP
mirrorlist in the
yum_repository LWRP must be set to the mirror list URI to use rather than setting it to true. See README.md.
- [COOK-1088] - use dl.fedoraproject.org for EPEL to prevent redirects
- [COOK-1653] - fix mirrorlist
- [COOK-1710] - support http proxy
- [COOK-1722] - update IUS version
- [COOK-1521] - add :update action to
- [COOK-1204] - Make 'add' default action for yum_repository
- [COOK-1351] - option to not make the yum cache (via attribute)
- [COOK-1353] - x86_64 centos path fixes
- [COOK-1414] - recipe for repoforge
- Updated README to remove git diff artifacts.
- Default action for the yum_repository LWRP is now add.
- [COOK-1227] - clear Chefs internal cache after adding new yum repo
- [COOK-1262] - yum::epel should enable existing repo on Amazon Linux
- [COOK-1272], [COOK-1302] - update RPM file for CentOS / RHEL 6
- [COOK-1330] - update cookbook documentation on excludes for yum
- [COOK-1346] - retry remote_file for EPEL in case we get an FTP mirror
- [COOK-825] - epel and ius
remote_fileshould notify the
- [COOK-675] - add recipe for handling EPEL repository
- [COOK-722] - add recipe for handling IUS repository
- Remove yum update in default recipe, that doesn't update caches, it updates packages installed.
Collaborator Number Metric
4.1.0 passed this metric
4.1.0 passed this metric
4.1.0 passed this metric
4.1.0 passed this metric