Puppet

How to integrate Puppet with Cloudsmith

5068

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

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,
    },
  }
}
class cloudsmith_repo {

  include apt

  apt::key { 'cloudsmith':
    id      => 'FINGERPRINT-LONG,
    source  => 'https://USERNAME:[email protected]/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:[email protected]/basic/OWNER/REPOSITORY/deb/DISTRO',
    release  => 'VERSION',
    repos    => 'main',
    pin      => 500,
    include  => {
      'src' => true,
      'deb' => true,
    },
  }

}
class cloudsmith_repo {

  include apt

  apt::key { 'cloudsmith':
    id      => 'FINGERPRINT-LONG,
    source  => 'https://USERNAME:[email protected]/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:[email protected]/basic/OWNER/REPOSITORY/deb/DISTRO',
    release  => 'VERSION',
    repos    => 'main',
    pin      => 500,
    include  => {
      'src' => true,
      'deb' => true,
    },
  }
}
class cloudsmith_repo {

  include apt

  apt::key { 'cloudsmith':
    id      => 'FINGERPRINT-LONG,
    source  => 'https://token:[email protected]/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:[email protected]/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',
  }

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)