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 24, 2022
1 parent 774ac8d commit 7f03904
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 4 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
1 change: 1 addition & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ 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'
1 change: 1 addition & 0 deletions data/os/Debian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
influxdb::repo_url: 'https://repos.influxdata.com/debian'
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
23 changes: 21 additions & 2 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,6 +53,7 @@
Integer $port,
String $initial_org,
String $initial_bucket,
String $repo_gpg_key_id,
String $repo_url,
String $repo_gpg_key_url,

Expand Down Expand Up @@ -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 7f03904

Please sign in to comment.