Integrating Puppet

How to integrate Puppet with Cloudsmith

Puppet is open-core software for provisioning, configuration management, and application deployment. Puppet declaratively manages the configuration of Unix-like, macOS and Microsoft Windows systems.

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)
FINGERPRINT-LONGThe 20 Byte fingerprint of the Public GPG key for the repository
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
PACKAGEThe name of the package

Debian repository

Configuration

To add a Cloudsmith repository for Debian packages using Puppet, you would use the Puppet apt module .

Example Puppet Class using apt module:

Public Repository

class cloudsmith_repo {

  include apt

  apt::key { 'cloudsmith':
    id      => 'FINGERPRINT-LONG,
    source  => 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key',
  }

  apt::source { 'cloudsmith':
    comment  => 'A Description added to repo config in /etc/apt/sources.list.d/',
    location => 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/deb/DISTRO',
    release  => 'VERSION',
    repos    => 'main',
    pin      => 500,
    include  => {
      'src' => true,
      'deb' => true,
    },
  }
}

Private Repository

text
class cloudsmith_repo {

  include apt

  apt::key { 'cloudsmith':
    id      => 'FINGERPRINT-LONG,
    source  => 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key',
  }

  apt::source { 'cloudsmith':
    comment  => 'A Description added to repo config in /etc/apt/sources.list.d/',
    location => 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/deb/DISTRO',
    release  => 'VERSION',
    repos    => 'main',
    pin      => 500,
    include  => {
      'src' => true,
      'deb' => true,
    },
  }
}
text
class cloudsmith_repo {

  include apt

  apt::key { 'cloudsmith':
    id      => 'FINGERPRINT-LONG,
    source  => 'https://USERNAME:PASSWORD@dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key',
  }

  apt::source { 'cloudsmith':
    comment  => 'A Description added to repo config in /etc/apt/sources.list.d/',
    location => 'https://USERNAME:PASSWORD@dl.cloudsmith.io/basic/OWNER/REPOSITORY/deb/DISTRO',
    release  => 'VERSION',
    repos    => 'main',
    pin      => 500,
    include  => {
      'src' => true,
      'deb' => true,
    },
  }

}
text
class cloudsmith_repo {

  include apt

  apt::key { 'cloudsmith':
    id      => 'FINGERPRINT-LONG,
    source  => 'https://USERNAME:API-KEY@dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key',
  }

  apt::source { 'cloudsmith':
    comment  => 'A Description added to repo config in /etc/apt/sources.list.d/',
    location => 'https://USERNAME:API-KEY@dl.cloudsmith.io/basic/OWNER/REPOSITORY/deb/DISTRO',
    release  => 'VERSION',
    repos    => 'main',
    pin      => 500,
    include  => {
      'src' => true,
      'deb' => true,
    },
  }
}
text
class cloudsmith_repo {

  include apt

  apt::key { 'cloudsmith':
    id      => 'FINGERPRINT-LONG,
    source  => 'https://token:TOKEN@dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key',
  }

  apt::source { 'cloudsmith':
    comment  => 'A Description added to repo config in /etc/apt/sources.list.d/',
    location => 'https://token:TOKEN@dl.cloudsmith.io/basic/OWNER/REPOSITORY/deb/DISTRO',
    release  => 'VERSION',
    repos    => 'main',
    pin      => 500,
    include  => {
      'src' => true,
      'deb' => true,
    },
  }
}

Package Installation

After you have configured the repository, you can then install a package using:

  package { 'PACKAGE':
    ensure  => 'latest',
  }