Chef

How to integrate Chef with Cloudsmith

50685068

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:

Identifier

Description

OWNER

Your Cloudsmith account name or organisation name (namespace)

REPOSITORY

Your Cloudsmith Repository name (also called "slug")

DISTRO

Your distribution (i.e el, fedora, debian etc)

VERSION

Your version name (i.e 7, 29, hardy, buster etc)

ARCH

The architecture (i.e x86_64)

FINGERPRINT

The 8 Byte fingerprint of the Public GPG key for the repository

TOKEN

Your Cloudsmith Entitlement Token (see Entitlements for more details)

USERNAME

Your Cloudsmith username

PASSWORD

Your Cloudsmith password

API-KEY

Your 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.


Did this page help you?

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)