Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add debian repo support #37

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 additions & 0 deletions 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_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
25 changes: 22 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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 Package repository
# @param repo_gpg_key_url
Expand All @@ -53,9 +55,10 @@
Integer $port,
String $initial_org,
String $initial_bucket,
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,
Expand All @@ -82,7 +85,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 {
m0dular marked this conversation as resolved.
Show resolved Hide resolved
#TODO: other distros
case $facts['os']['family'] {
'RedHat': {
Expand All @@ -96,6 +99,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 @@ -107,7 +126,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