The Cloudsmith Developer Hub

Welcome to the Cloudsmith Developer Hub. You'll find comprehensive guides and documentation to help you start working with Cloudsmith as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Ansible

How to integrate Ansible with Cloudsmith

Ansible is open-source software for provisioning, configuration management, and application deployment.

In the following examples:

IdentifierDescription
OWNERYour Cloudsmith account name or organisation name (namespace)
REPOSITORYYour Cloudsmith Repository name (also called "slug")
DISTROYour distribution (i.e el, fedora, debian etc)
VERSIONYour version name (i.e 7, 29, hardy, buster etc)
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 add a Cloudsmith repository for RPM packages using Ansible, you would use the Ansible yum_repository module. The yum_repository module can add or remove YUM repositories in RPM-based Linux distributions.

Example yum_repository task:

Public Repository

- name: Add Cloudsmith Repository
  yum_repository:
    name: cloudsmith
    description: Cloudsmith
    file: cloudsmith
    baseurl: https://dl.cloudsmith.io/public/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch
    repo_gpgcheck: yes
    gpgkey: https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    enabled: yes
  become: true

Private Repository

- name: Add Cloudsmith Repository
  yum_repository:
    name: cloudsmith
    description: Cloudsmith
    file: cloudsmith
    baseurl: https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch
    repo_gpgcheck: yes
    gpgkey: https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    enabled: yes 
  become: true
- name: Add Cloudsmith Repository
  yum_repository:
    name: cloudsmith
    description: Cloudsmith
    file: cloudsmith
    baseurl: https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch
    repo_gpgcheck: yes
    gpgkey: https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    username: USERNAME
    password: PASSWORD
    enabled: yes
  become: true
- name: Add Cloudsmith Repository
  yum_repository:
    name: cloudsmith
    description: Cloudsmith
    file: cloudsmith
    baseurl: https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch
    repo_gpgcheck: yes
    gpgkey: https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    username: USERNAME
    password: API-KEY
    enabled: yes
  become: true
- name: Add Cloudsmith Repository
  yum_repository:
    name: cloudsmith
    description: Cloudsmith
    file: cloudsmith
    baseurl: https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/rpm/DISTRO/VERSION/$basearch
    repo_gpgcheck: yes
    gpgkey: https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    username: token
    password: TOKEN
    enabled: yes
  become: true

Adding a Debian repository

To add a Cloudsmith repository for Debian packages using Ansible, you would use the Ansible apt_key module and the apt_repository module.

Example apt_key and apt_repository tasks:

Public Repository

- name: Import Cloudsmith Repository GPG key
  apt_key:
    url: https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    state: present
  become: true

- name: Add Cloudsmith Repository
  apt_repository:
    repo: deb https://dl.cloudsmith.io/public/OWNER/REPOSITORY/deb/DISTRO VERSION main
    state: present
  become: true

Private Repository

- name: Import Cloudsmith Repository GPG key
  apt_key:
    url: https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    state: present
  become: true

- name: Add Cloudsmith Repository
  apt_repository:
    repo: deb https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/deb/DISTRO VERSION main
    state: present
  become: true
- name: Import Cloudsmith Repository GPG key
  apt_key:
    url: https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    state: present
  become: true

- name: Add Cloudsmith Repository
  apt_repository:
    repo: deb https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/deb/DISTRO VERSION main
    state: present
  become: true
- name: Import Cloudsmith Repository GPG key
  apt_key:
    url: https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    state: present
  become: true

- name: Add Cloudsmith Repository
  apt_repository:
    repo: deb https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/deb/DISTRO VERSION main
    state: present
  become: true
- name: Import Cloudsmith Repository GPG key
  apt_key:
    url: https://token:[email protected]/basic/OWNER/REPOSITORY/cfg/gpg/gpg.FINGERPRINT.key
    state: present
  become: true

- name: Add Cloudsmith Repository
  apt_repository:
    repo: deb https://token:[email protected]/basic/OWNER/REPOSITORY/deb/DISTRO VERSION main
    state: present
  become: true

Additional Formats

Example Ansible tasks for additional package formats will be coming soon.

Updated 21 days ago


Ansible


How to integrate Ansible with Cloudsmith

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.