Chef

How to integrate Chef with Cloudsmith

Chef is a configuration management tool written in Ruby and Erlang. It uses a Ruby DSL for writing "recipes". Chef recipes are then used automate and maintain system configurations.

  • Chef : The Chef website.
  • Chef Docs : The Official Chef Documentation

In the following examples:

IdentifierDescription
OWNERYour Cloudsmith organisation name (namespace)
REPOSITORYYour Cloudsmith Repository identifier (also called "slug")
DISTROYour distribution (i.e el, fedora, debian etc)
VERSIONYour version name (i.e 7, 29, hardy, buster etc)
ARCHThe architecture (i.e x86_64)
FINGERPRINTThe 8 Byte fingerprint of the Public GPG key for the repository
TOKENYour Cloudsmith Entitlement Token (see Entitlements for more details)
USERNAMEYour Cloudsmith username
PASSWORDYour Cloudsmith password
API-KEYYour Cloudsmith API Key

Adding a RPM repository

To configure a Cloudsmith repository for rpm packages using Chef, you use the Chef yum_repository resource.

Example yum_repository resource configurations:

Public Repository

yum_repository 'Cloudsmith' do
  description 'Cloudsmith'
  baseurl 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch'
  gpgcheck 'true'
  gpgkey 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
  action :create
end

Private Repository

yum_repository 'Cloudsmith' do
  description 'Cloudsmith'
  baseurl 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch'
  gpgcheck 'true'
  gpgkey 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
  action :create
end
yum_repository 'Cloudsmith' do
  description 'Cloudsmith'
  baseurl 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch'
  gpgcheck 'true'
  gpgkey 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
  username 'USERNAME'
  password 'PASSWORD'
  action :create
end
yum_repository 'Cloudsmith' do
  description 'Cloudsmith'
  baseurl 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch'
  gpgcheck 'true'
  gpgkey 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
  username 'USERNAME'
  password 'API-KEY'
  action :create
end
yum_repository 'Cloudsmith' do
  description 'Cloudsmith'
  baseurl 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch'
  gpgcheck 'true'
  gpgkey 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
  username 'token'
  password 'TOKEN'
  action :create
end

Adding a deb repository

To configure a Cloudsmith repository for deb packages using Chef, you use the Chef apt_repository resource.

Example apt_repository resource configurations:

Public Repository

apt_repository 'Cloudsmith' do
  uri          'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/deb/DISTRO'
  arch         'ARCH'
  distribution 'VERSION'
  components   ['main']
  key          'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
end

Private Repository

apt_repository 'Cloudsmith' do
  uri          'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/deb/DISTRO'
  arch         'ARCH'
  distribution 'VERSION'
  components   ['main']
  key          'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
end
apt_repository 'Cloudsmith' do
  uri          'https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/deb/DISTRO'
  arch         'ARCH'
  distribution 'VERSION'
  components   ['main']
  key          'https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
end
apt_repository 'Cloudsmith' do
  uri          'https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/deb/DISTRO'
  arch         'ARCH'
  distribution 'VERSION'
  components   ['main']
  key          'https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
end
apt_repository 'Cloudsmith' do
  uri          'https://token:[email protected]/basic/OWNER/REPOSITORY/deb/DISTRO'
  arch         'ARCH'
  distribution 'VERSION'
  components   ['main']
  key          'https://token:[email protected]/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key'
end

Additional Formats

Chef Examples for additional package formats will be coming soon.


Cloudsmith is the new standard in Package / Artifact Management and Software Distribution

With support for all major package formats, you can trust us to manage your software supply chain.


Start My Free Trial Now
Cookie Declaration (Manage Cookies)