Skip to content

Commit

Permalink
add debian repo support
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Hoenscheid committed Aug 26, 2022
1 parent 774ac8d commit 854eeab
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 7 deletions.
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fixtures:
forge_modules:
archive: "puppet/archive"
yumrepo: "puppetlabs/yumrepo_core"
apt: "puppetlabs/apt"
repositories:
facts: 'https://github.com/puppetlabs/puppetlabs-facts'
puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent'
Expand Down
4 changes: 3 additions & 1 deletion data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ influxdb::host: "%{facts.fqdn}"
influxdb::port: 8086
influxdb::initial_org: 'puppetlabs'
influxdb::initial_bucket: 'puppet_data'
influxdb::repo_gpg_key_url: 'https://repos.influxdata.com/influxdb.key'
influxdb::repo_gpg_key_id: '05CE15085FC09D18E99EFB22684A14CF2582E0C5'
influxdb::repo_gpg_key_url: 'https://repos.influxdata.com/influxdb2.key https://repos.influxdata.com/influxdb.key'
influxdb::manage_repo: false
4 changes: 4 additions & 0 deletions data/os/Debian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
influxdb::repo_url: 'https://repos.influxdata.com/debian'
influxdb::manage_repo: true
influxdb::repo_gpg_key_url: 'https://repos.influxdata.com/influxdb.key'
influxdb::version: latest
1 change: 1 addition & 0 deletions data/os/RedHat.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
influxdb::repo_url: 'https://repos.influxdata.com/rhel/$releasever/$basearch/stable'
influxdb::manage_repo: true
1 change: 1 addition & 0 deletions data/os/Ubuntu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
influxdb::repo_url: 'https://repos.influxdata.com/debian'
1 change: 0 additions & 1 deletion hiera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ hierarchy:
- name: "osfamily/major release"
paths:
# Used to distinguish between Debian and Ubuntu
- "os/%{facts.os.name}.yaml"
- "os/%{facts.os.name}/%{facts.os.release.major}.yaml"
- "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
# Used for Solaris
Expand Down
27 changes: 23 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
# @param token_file
# File on disk containing an administrative token. This class will write the token generated as part of initial setup to this file.
# Note that functions or code run in Puppet server will not be able to use this file, so setting $token after setup is recommended.
# @param repo_gpg_key_id
# ID of the GPG signing key
# @param repo_url
# URL of the RPM repository
# @param repo_gpg_key_url
Expand All @@ -51,12 +53,13 @@
Integer $port,
String $initial_org,
String $initial_bucket,
String $repo_url,
String $repo_gpg_key_id,
String $repo_gpg_key_url,
Boolean $manage_repo,

Boolean $manage_repo = true,
Boolean $manage_setup = true,

Optional[String] $repo_url = undef,
String $repo_name = 'influxdb2',
String $version = '2.1.1',
Variant[String,Boolean[false]] $archive_source = 'https://dl.influxdata.com/influxdb/releases/influxdb2-2.1.1-linux-amd64.tar.gz',
Expand All @@ -81,7 +84,7 @@
}

# If we are managing the repository, set it up and install the package with a require on the repo
if $manage_repo and $facts['os']['family'] in ['Redhat'] {
if $manage_repo {
#TODO: other distros
case $facts['os']['family'] {
'RedHat': {
Expand All @@ -95,6 +98,22 @@
gpgcheck => '1',
target => '/etc/yum.repos.d/influxdb2.repo',
}
$package_require = Yumrepo[$repo_name]
}
'Debian': {
include apt
apt::source { $repo_name:
ensure => 'present',
comment => 'The InfluxDB2 repository',
location => $repo_url,
release => 'stable',
repos => 'main',
key => {
'id' => $repo_gpg_key_id,
'source' => $repo_gpg_key_url,
},
}
$package_require = Apt::Source[$repo_name]
}
default: {
notify {'influxdb_repo_warn':
Expand All @@ -106,7 +125,7 @@

package {'influxdb2':
ensure => $version,
require => Yumrepo[$repo_name],
require => $package_require,
before => Service['influxdb'],
}
}
Expand Down
6 changes: 5 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"dependencies": [
{
"name": "puppet/archive",
"version_requirement": ">= 6.0.0 <7.0"
"version_requirement": ">= 6.0.0 <7.0.0"
},
{
"name": "puppetlabs/apt",
"version_requirement": ">= 9.0.0 <10.0.0"
}
],
"operatingsystem_support": [
Expand Down

0 comments on commit 854eeab

Please sign in to comment.