{"id":19715431,"url":"https://github.com/tubemogul/puppet-aptly","last_synced_at":"2025-08-09T00:23:47.220Z","repository":{"id":30861458,"uuid":"34419017","full_name":"tubemogul/puppet-aptly","owner":"tubemogul","description":"Puppet module to deploy and manage aptly, a Debian repository management tool  http://www.aptly.info/","archived":false,"fork":false,"pushed_at":"2021-02-11T13:02:01.000Z","size":153,"stargazers_count":5,"open_issues_count":17,"forks_count":28,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-05T19:01:40.922Z","etag":null,"topics":["aptly","aptly-server","puppet","puppet-module"],"latest_commit_sha":null,"homepage":"https://forge.puppet.com/TubeMogul/aptly","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tubemogul.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-22T22:18:57.000Z","updated_at":"2024-04-04T05:27:59.000Z","dependencies_parsed_at":"2022-09-07T01:50:42.784Z","dependency_job_id":null,"html_url":"https://github.com/tubemogul/puppet-aptly","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tubemogul%2Fpuppet-aptly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tubemogul%2Fpuppet-aptly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tubemogul%2Fpuppet-aptly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tubemogul%2Fpuppet-aptly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tubemogul","download_url":"https://codeload.github.com/tubemogul/puppet-aptly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251578244,"owners_count":21611998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aptly","aptly-server","puppet","puppet-module"],"created_at":"2024-11-11T22:38:23.461Z","updated_at":"2025-04-29T20:30:37.620Z","avatar_url":"https://github.com/tubemogul.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aptly Puppet module\n\n[![TravisBuild](https://travis-ci.org/tubemogul/puppet-aptly.svg?branch=master)](https://travis-ci.org/tubemogul/puppet-aptly)\n[![Puppet Forge latest release](https://img.shields.io/puppetforge/v/TubeMogul/aptly.svg)](https://forge.puppetlabs.com/TubeMogul/aptly)\n[![Puppet Forge downloads](https://img.shields.io/puppetforge/dt/TubeMogul/aptly.svg)](https://forge.puppetlabs.com/TubeMogul/aptly)\n[![Puppet Forge score](https://img.shields.io/puppetforge/f/TubeMogul/aptly.svg)](https://forge.puppetlabs.com/TubeMogul/aptly/scores)\n\n#### Table of Contents\n\n1. [Overview](#overview)\n2. [Module Description - What the module does and why it is useful](#module-description)\n3. [Setup - The basics of getting started with aptly](#setup)\n    * [What aptly affects](#what-aptly-affects)\n    * [Setup requirements](#setup-requirements)\n    * [Beginning with aptly](#beginning-with-aptly)\n4. [Usage - Configuration options and additional functionality](#usage)\n    * [Basic example](#basic-example)\n    * [Enable aptly API endpoint](#enable-aptly-api-endpoint)\n    * [Create an apt mirror](#create-an-apt-mirror)\n    * [Create and drop apt repositories](#create-and-drop-apt-repositories)\n    * [Create an aptly snapshot](#create-an-aptly-snapshot)\n5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)\n  * [Public classes and defines](#public-classes-and-defines)\n  * [Private classes](#private-classes)\n  * [Providers and types](#providers-and-types)\n  * [Parameters](#parameters)\n5. [Limitations - OS compatibility, etc.](#limitations)\n6. [Development - Guide for contributing to the module](#development)\n\n## Overview\n\nThis module installs the [aptly](www.aptly.info) Debian packages repository manager and configures it.\n\nNeed help of want a new feature? File an issue on our github repository: https://github.com/tubemogul/puppet-aptly/issues\n\n## Module Description\n\nWhat is this module capable of doing?\n\n * Installing the aptly package in a specific version (or just the latest available)\n * Managing a specific user and group (with their corresponding fixed uid/gid) dedicated to the service\n * Configuring a specific debian repository (optional) where to find the package\n * Managing the `/etc/aptly.conf` file\n * Enabling/starting or disabling the service\n * Enabling/starting or disabling the API\n * Managing the init.d service file\n * Managing apt mirrors, repositories, snapshots and publications\n \nThe aptly service will listen on port you configure (example: 8080) on every interfaces (configurable)\nusing the `aptly serve -listen=\":8080\"` command.\n\nIf you want to make the repository being served by an apache, nginx or whatever\nelse, just disable the service and setup the http server you want for the HTTP(S)\nlayer in addition to this module.\n\n## Setup\n\n### What aptly affects\n\nFiles managed by the module:\n\n * `/etc/aptly.conf`\n * `/etc/apt/sources.list.d/aptly.list` (optional)\n * `/etc/init.d/aptly`\n\n### Setup Requirements\n\nThe module requires:\n * [Puppetlabs stdlib](https://github.com/puppetlabs/puppetlabs-stdlib.git)\n * [Puppetlab's APT module](https://github.com/puppetlabs/puppetlabs-apt.git) at least version 2.0.x\n\n### Beginning with aptly\n\nThe module can be used out of the box directly, it just requires puppetlabs' apt\nmodule and its stdlib to be in your modulepath.\n\nTo install:\n\n```\npuppet module install TubeMogul/aptly\n```\n\nPuppet will install the dependencies automatically, but if you want to install\nthe dependencies 1 by 1, you can use this before:\n\n```\npuppet module install puppetlabs/stdlib\npuppet module install puppetlabs/apt\n```\n\n## Usage\n\n**WARNING:** the aptly service won't start as long as nothing has been published\nin it. It is a totally expected behavior coming from aptly itself.\n\nThose examples include the puppet-only configuration, and the corresponding\nconfiguration for those who use hiera (I find it more convenient for copy/paste\nof a full configuration when you have both - yes, I'm lazy ;-) ).\n\n### Basic example\n\nThe default values are normally sane enough to do as few parameters overwrites\nas possible.\n\nBut let's say you want:\n * Aptly to store its data in `/data` (that you created before hand)\n * to only have the architectures `i386` and `amd64`\n * to have your ppa codename to be `foo`\n\nThen you just do:\n```puppet\nclass { 'aptly':\n  root_dir      =\u003e '/data',\n  architectures =\u003e ['i386', 'amd64'],\n  ppa_codename  =\u003e 'foo',\n}\n```\n\nOr using hiera:\n```yaml\n---\naptly::root_dir: /data\naptly::architectures:\n  - i386\n  - amd64\naptly::ppa_codename: foo\n```\n\n**NOTE:** this will also install the official aptly repo in your sources.list.d.\n\n### Enable aptly API endpoint\n\nTo:\n * enable the aptly API management\n * make the API listen on port `42000`\n * have the API listen on the private interface of your server (let's say this interface's IP is `10.0.0.123`)\n * have the API configured in no-lock mode as you are doing both cli and API calls\n\nThen you can do:\n```puppet\nclass { 'aptly':\n  enable_api =\u003e true,\n  api_port   =\u003e 42000,\n  api_bind   =\u003e '10.0.0.123',\n  api_nolock =\u003e true,\n}\n```\n\nOr using hiera:\n```yaml\n---\naptly::enable_api: true\naptly::api_port: 42000\naptly::api_bind: 10.0.0.123\naptly::api_nolock: true\n```\n\n### Create an apt mirror\n\n**Warning:** after creating the mirror, the update of the mirror from its source\nis initiated. This can take a significant amount of time.\n\nTo create an APT repository:\n * of the Debian US repo\n * of the stable distribution\n * only taking the main component\n * only for the amd64 architecture\n\nUse:\n```puppet\naptly::mirror { 'debian_stable':\n  location      =\u003e 'http://ftp.us.debian.org/debian/',\n  distribution  =\u003e 'stable',\n  components    =\u003e [ 'main' ],\n  architectures =\u003e ['amd64'],\n}\n```\n\n**Note:** This module does not manage the gpg keys directly, so if you don't take care of adding the gpg file of your target repository,\nyou'll end up with the following error:\n\n```\nError: /Stage[main]/Main/Aptly::Mirror[debian_stable]/Aptly_mirror[debian_stable]/ensure: change from absent to present failed: Execution of 'aptly -architectures=amd64 -with-sources=false -with-udebs=false mirror create debian_stable http://ftp.us.debian.org/debian/ stable main' returned 1: Looks like your keyring with trusted keys is empty. You might consider importing some keys.\nIf you're running Debian or Ubuntu, it's a good idea to import current archive keys by running:\n\n  gpg --no-default-keyring --keyring /usr/share/keyrings/debian-archive-keyring.gpg --export | gpg --no-default-keyring --keyring trustedkeys.gpg --import\n\n(for Ubuntu, use /usr/share/keyrings/ubuntu-archive-keyring.gpg)\n\nDownloading http://ftp.us.debian.org/debian/dists/stable/InRelease...\nDownloading http://ftp.us.debian.org/debian/dists/stable/Release...\nDownloading http://ftp.us.debian.org/debian/dists/stable/Release.gpg...\ngpgv: Signature made Sat Jun  4 08:26:51 2016 GMT+5 using RSA key ID 46925553\ngpgv: Can't check signature: public key not found\ngpgv: Signature made Sat Jun  4 08:26:51 2016 GMT+5 using RSA key ID 2B90D010\ngpgv: Can't check signature: public key not found\ngpgv: Signature made Sat Jun  4 08:36:26 2016 GMT+5 using RSA key ID 518E17E1\ngpgv: Can't check signature: public key not found\n\nLooks like some keys are missing in your trusted keyring, you may consider importing them from keyserver:\n\ngpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keys.gnupg.net --recv-keys 8B48AD6246925553 7638D0442B90D010 CBF8D6FD518E17E1\n\nSometimes keys are stored in repository root in file named Release.key, to import such key:\n\nwget -O - https://some.repo/repository/Release.key | gpg --no-default-keyring --keyring trustedkeys.gpg --import\n\nERROR: unable to fetch mirror: verification of detached signature failed: exit status 2\n```\n\nHere's a full example of how you can manage your gpg keys along with the mirror:\n```puppet\naptly::mirror { 'debian_stable':\n  location      =\u003e 'http://ftp.us.debian.org/debian/',\n  distribution  =\u003e 'stable',\n  components    =\u003e [ 'main'] ,\n  architectures =\u003e ['amd64'],\n}\n\nexec { 'debian_stable_key_8B48AD6246925553':\n  command =\u003e '/usr/bin/gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keys.gnupg.net --recv-key 8B48AD6246925553',\n  unless  =\u003e '/usr/bin/gpg --no-default-keyring --keyring trustedkeys.gpg --list-key 8B48AD6246925553 \u003e /dev/null 2\u003e\u00261',\n}\n\nexec { 'debian_stable_key_7638D0442B90D010':\n  command =\u003e '/usr/bin/gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keys.gnupg.net --recv-key 7638D0442B90D010',\n  unless  =\u003e '/usr/bin/gpg --no-default-keyring --keyring trustedkeys.gpg --list-key 7638D0442B90D010 \u003e /dev/null 2\u003e\u00261',\n}\n\nexec { 'debian_stable_key_CBF8D6FD518E17E1':\n  command =\u003e '/usr/bin/gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keys.gnupg.net --recv-key CBF8D6FD518E17E1',\n  unless  =\u003e '/usr/bin/gpg --no-default-keyring --keyring trustedkeys.gpg --list-key CBF8D6FD518E17E1 \u003e /dev/null 2\u003e\u00261',\n}\n\n\nExec['debian_stable_key_8B48AD6246925553']-\u003e\nExec['debian_stable_key_7638D0442B90D010']-\u003e\nExec['debian_stable_key_CBF8D6FD518E17E1']-\u003e\nAptly::Mirror['debian_stable']\n```\n\n### Create and drop apt repositories\n\nUsing the `aptly::repo` is really simple. In this example, we will:\n * drop the `my_custom_repo` repository\n * create the `tubemogul_apps` repository (with \"stable\" as default component\n   for publishing)\n\nUse:\n```puppet\n# Dropping the 'my_custom_repo' repo\naptly::repo {'my_custom_repo':\n  ensure =\u003e absent,\n}\n\n# Making sure that the 'tubemogul_apps' exists with the expected parameters\naptly::repo {'tubemogul_apps':\n  default_component =\u003e 'stable',\n}\n```\n\nOnce you've done that, you can add packages using the `aptly repo add tubemogul_apps my_package.deb` or using the API.\n\n### Create an aptly snapshot\n\nOnce you've created your repo and added packages to it, you might want to take a\nsnapshot of a stable stack or a coherent ensemble to publish it later.\n\nThis example creates a snapshot named `nightly_20160823` based on the repository\n`tubemogul_apps` that we created in the previous example:\n\n```puppet\naptly::snapshot { 'nightly_20160823':\n  source_type =\u003e 'repository',\n  source_name =\u003e 'tubemogul_apps',\n}\n```\n\n## Reference\n\n### Public classes and defines\n\n * [`aptly`](#class-aptly): Installs and configures the aptly server.\n * [`aptly::mirror`](#define-aptlymirror): Manages an aptly mirror.\n * [`aptly::repo`](#define-aptlyrepo): Manages an aptly repository.\n * [`aptly::snapshot`](#define-aptlysnapshot): Manages an aptly snapshot.\n * [`aptly::publish`](#define-aptlypublish): Manages an aptly publication.\n\n### Private classes\n\n * `aptly::install`: Installs the aptly server.\n * `aptly::config`: Configures the aptly server.\n * `aptly::service`: Manages the aptly server and the API services.\n\n### Providers and types\n\nTo manage the aptly resources, this modules embeds the following custom\ntypes and corresponding providers (to be accessed via the public defines):\n\n * `aptly_mirror` to manage an aptly mirror\n * `aptly_repo` to manage an aptly repository\n * `aptly_snapshot` to manage an aptly snapshot\n * `aptly_publish` to manage an aptly publication\n\n### Parameters\n\n#### Class aptly\n\n##### `version`\n\nAptly version to ensure to install.\nYou can use a version number to force a version or just use `installed` or\n`latest` to benefit from the usual Puppet behavior.\n\nDefault: `installed`\n\n##### `install_repo`\n\nBoolean to manage whether or not you want to have a sources.list repo\nmanaged by the module.\n\nDefault: `true`\n\n##### `repo_location`\n\nLocation of the remote repo to manage when using `install_repo` to `true`.\n\nDefault: `http://repo.aptly.info`\n\n##### `repo_release`\n\nRelease of the repo to use when using `install_repo` to `true`.\n\nDefault: `squeeze`\n\n##### `repo_repos`\n\nRepo name to use in the repo when using `install_repo` to `true`.\n\nDefault: `main`\n\n##### `repo_keyserver`\n\nKey server to use to retreive the key of the repo when using `install_repo`\nto `true`.\n\nDefault: `keys.gnupg.net`\n\n##### `repo_key`\n\nKey used by the signed repo when using `install_repo` to `true`.\n\nDefault: `DF32BC15E2145B3FA151AED19E3E53F19C7DE460`\n\n##### `enable_service`\n\nBoolean to enable or disable the service.\n\nDefault: `true` (service enabled)\n\n##### `port`\n\nPort for the Aptly webserver\n\nDefault : `8080`\n\n##### `bind`\n\nIP address of the Aptly webserver (`0.0.0.0` or empty string meaning that you\nlisten on all interfaces).\n\nDefault: `0.0.0.0`\n\n##### `config_filepath`\n\nPath of the configuration file to be used by the aptly service.\n\nDefault: `/etc/aptly.conf`\n\n##### `manage_user`\nWhethere should this module manage aptly user or not\n\nDefault: `true`\n\n##### `user`\n\nOS user which will run the service.\n\nDefault: `aptly`\n\n##### `uid`\n\nUID of the OS user which will run the service.\n\nDefault: `450`\n\n##### `group`\n\nGroup of the OS user which will run the service.\n\nDefault: `aptly`\n\n##### `gid`\n\nGID of the group of the OS user which will run the service.\n\nDefault: `450`\n\n##### `root_dir`\n\nRoot directory to use for storing the repo data.\n\nDefault: `/var/aptly`\n\n##### `architectures`\n\nArchitectures managed by the repo.\n\nDefault: `[\"amd64\"]`\n\n##### `ppa_dist`\n\nDistribution code of the ppa to serve.\n\nDefault: `ubuntu`\n\n##### `ppa_codename`\n\nCodename of the ppa to serve.\n\nDefault: `''`\n\n\n##### `properties`\n\nHash containing the optional properties of the aptly.conf. The key is the\nproperty name and the value is its value!\n\nDefault:\n\n```\n{\n  'downloadConcurrency'         =\u003e 4,\n  'downloadSpeedLimit'          =\u003e 0,\n  'dependencyFollowSuggests'    =\u003e false,\n  'dependencyFollowRecommends'  =\u003e false,\n  'dependencyFollowAllVariants' =\u003e false,\n  'dependencyFollowSource'      =\u003e false,\n  'gpgDisableSign'              =\u003e false,\n  'gpgDisableVerify'            =\u003e false,\n  'downloadSourcePackages'      =\u003e false,\n}\n```\n\n\n##### `s3_publish_endpoints`\n\nHash to describe the s3PublishEndpoints property of the aptly.conf.\n\nDefault: `{}`\n\n##### `swift_publish_endpoints`\n\nHash to describe the SwiftPublishEndpoints property of the aptly.conf.\n\nDefault: `{}`\n\n##### `enable_api`\n\nEnable Aptly API by starting the service\n\nDefault : `false`\n\n##### `api_port`\n\nPort for the Aptly API service.\n\nDefault : `8081`\n\n##### `api_bind`\n\nBinding address for the Aptly API service.\n\nDefault : `0.0.0.0`\n\n##### `api_nolock`\n\nIf `true`, the API service will not lock the database (for situations where you\nheavily use both the API and the cli for example).\n\nDefault : `false`\n\n##### `manage_xz_utils`\n\nBoolean to enable or disable installation of the xz-utils package (required\ndependency for aptly).\n\nDefault : `true`\n\n#### Define aptly::mirror\n\n##### `ensure`\n\nEnsures if the mirror must be `present` (should exist) or `absent` (or be\ndestroyed).\n\nDefault: `present`\n\n##### `uid`\n\nUID of the OS user which will run the cli\n\nDefault: `450`\n\n##### `gid`\n\nGID of the OS user which will run the cli\n\nDefault: `450`\n\n##### `location`\n\nLocation of the repository to mirror.\n\nDefault: `undef`\n\n##### `distribution`\n\nDistribution to mirror.\n\nDefault: `$::lsbdistcodename`\n\n##### `architectures`\n\nArchitectures to mirror.\n\nDefault: `[]`\n\n##### `components`\n\nComponents to mirror.\n\nDefault: `[]`\n\n##### `with_sources`\n\nMirror the sources packages or not.\n\nDefault: `false`\n\n##### `with_udebs`\n\nDownload the .udeb packages.\n\nDefault: `false`\n\n#### Define aptly::repo\n\n##### `ensure`\n\nEnsures if the repository must be `present` (should exist) or `absent` (or be\ndestroyed).\n\nDefault: `present`\n\n##### `uid`\n\nUID of the OS user which will run the cli\n\nDefault: `450`\n\n##### `gid`\n\nGID of the OS user which will run the cli\n\nDefault: `450`\n\n##### `default_distribution`\n\nDefault distribution (used only when publishing).\n\nDefault: `$::lsbdistcodename`\n\n##### `default_component`\n\nDefault component (used only when publishing).\n\nDefault: `main`\n\n#### Define aptly::snapshot\n\n##### `ensure`\n\nEnsures if the snapshot must be `present` (should exist) or `absent` (or be\ndestroyed).\n\nDefault: `present`\n\n##### `uid`\n\nUID of the OS user which will run the cli\n\nDefault: `450`\n\n##### `gid`\n\nGID of the OS user which will run the cli\n\nDefault: `450`\n\n##### `source_type`\n\nType of source to snapshot. Correct values are:\n\n * `mirror`\n * `repo`\n * `empty`\n\nDefault: `undef`\n\n##### `source_name`\n\nName of the source to create snapshot from.\n\nDefault: `undef`\n\n#### Define aptly::publish\n\n##### `ensure`\n\nEnsures that the publication is `present` (should exist) or `absent` (or should be\ndestroyed).\n\nDefault: `present`\n\n##### `uid`\n\nUID of the OS user which will run the cli\n\nDefault: `450`\n\n##### `gid`\n\nGID of the OS user which will run the cli\n\nDefault: `450`\n\n##### `source_type`\n\nType of source to publish. Supported values are:\n\n * `repo`\n * `snapshot`\n\nDefault: `undef`\n\n##### `distribution`\n\nDistribution name to publish.\n\nDefault: `\"${::lsbdistcodename}-${name}\"`\n\n## Limitations\n\nThis module has been tested against Puppet 3.8 with Ubuntu clients.\n\nThe spec tests work on Puppet 3.7+ and 4.x.\n\nTo work on Debian OS family servers, it requires the apt module from Puppetlabs\nto be installed if you want to have this module manage your aptly repository (optionnal).\n\nThe implementation for the installation on other operating systems has not been\ndone yet but should be pretty straightforward to do. Just ask which one you want\nand we'll add it or submit a pull request on our github page and we'll integrate\nit.\n\n\n## Development\n\nWe're actually nice people and we rarely bite, so you're more than welcome to\ncontribute to our repos via the usual GitHub PR and issues.\n\nWhat we ask generally is that when you push a change or a new functionnality,\nyou add the corresponding tests at the same time. You'll find a lot of tests\nexamples in this repository.\n\nSee the [CONTRIBUTING.md](https://github.com/tubemogul/puppet-aptly/blob/master/CONTRIBUTING.md) file for more detailed guidelines.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftubemogul%2Fpuppet-aptly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftubemogul%2Fpuppet-aptly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftubemogul%2Fpuppet-aptly/lists"}