chef-boneyard / redhat-subscription-manager-cookbook

Cookbook providing custom resources for interacting with Red Hat Subscription Manager
Apache License 2.0
4 stars 18 forks source link

The resources in this cookbook now ship as part of Chef 14. This cookbook is now deprecated and no further updates will be made. We highly recommend you update to Chef 14 and submit and issues you find to the Chef github repo at https://github.com/chef/chef

redhat_subscription_manager cookbook

The Red Hat Subscription Manager (RHSM) cookbook provides custom resources for use in recipes to interact with RHSM or a locally-installed Red Hat Satellite. These resources allow you to configure your hosts' registration status, repo status, and installation of errata.

Scope

This cookbook focuses on Red Hat Enterprise Linux hosts with support for the subscription-manager tool and the new style of registration and subscription management. It does not support the former rhn_register or spacewalk-channel method of channel registration.

Requirements

Usage

Place a dependency on the redhat_subscription_manager cookbook in your cookbook's metadata.rb:

depends 'redhat_subscription_manager'

Then, in a recipe:

rhsm_register 'myhost' do
  activation_key 'mykey1234'
  satellite_host 'satellite.mycompany.com'
  action :register
end

Resources

rhsm_register

The rhsm_register resource performs the necessary tasks to register your host with RHSM or your local Satellite server.

Actions

Properties

Examples

rhsm_register 'myhost' do
  satellite_host 'satellite.mycompany.com'
  activation_key [ 'key1', 'key2' ]
end

rhsm_register 'myhost' do
  username 'myuser'
  password 'mypassword'
  environment 'myenvironment'
  auto_attach true
end

rhsm_register 'myhost' do
  action :unregister
end

rhsm_subscription

The rhsm_subscription resource will add another subscription to your host. This can be used when a host's activation_key does not attach all necessary subscriptions to your host.

Actions

Properties

None. The name passed in to the resource will be the pool ID to use when attaching/removing.

Examples

rhsm_subscription 'pool123' do
  action :attach
end

rhsm_subscription 'pool321' do
  action :remove
end

rhsm_repo

The rhsm_repo resource enabled and disables repositories that are made available via attached subscriptions.

Actions

Properties

None. The name passed in to the resource will be the repository name to use when enabling/disabling.

Examples

rhsm_repo 'rhel-7-myrepo' do
  action :enable
end

rhsm_repo 'rhel-7-oldrepo' do
  action :disable
end

rhsm_errata

The rhsm_errata resource will ensure packages associated with a given Errata ID are installed. This is helpful if packages to mitigate a single vulnerability must be installed on your hosts.

Actions

Properties

None. The name passed in to the resource will be the Errata ID to use when installing packages.

Examples

rhsm_errata 'RHSA:2015-1234'

rhsm_errata 'RHSA:2015-4321' do
  action :install
end

rhsm_errata_level

The rhsm_errata_level resource will install all packages for all errata of a certain security level. For example, you can ensure that all packages associated with errata marked at a "Critical" security level are installed.

Actions

Properties

None. The name passed in to the resource will be the security level to use when installing packages.

Valid security levels are: critical, moderate, important, and low. While yum is case sensitive, the values expected by this cookbook are not.

Examples

rhsm_errata_level 'critical'

rhsm_errata_level 'IMPORTANT' do
  action :install
end

Attributes

License and Authors

Author:: Chef Partner Engineering (partnereng@chef.io)

Copyright:: 2015-2018 Chef Software, Inc.

License:: Apache License, Version 2.0

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.

Contributing

  1. Fork it ( https://github.com/chef-partners/redhat-subscription-manager-cookbook/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request