Skip to content
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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,26 @@ puppet module to install and configure [influxdb](https://influxdb.org) (version

## Usage


Basic default uses local package

`class { 'influxdb': }`

Install from amazon.s3 is default when not using repository
```
class { 'influxdb':
install_from_repository => false,
}
```
Install using your own url/proxy
```
class { 'influxdb':
install_from_repository => false,
source_url => 'https://download.test.com/proxy/influxdb/influxdb-1.0.0.rpm'
}
```


These configuration parameter can be set:
```
$ensure = 'installed'
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$meta_hostname = $influxdb::params::meta_hostname,
$meta_peers = $influxdb::params::meta_peers,
$retention_replication = $influxdb::params::retention_replication,
$download_url = $influxdb::params::download_url,
) inherits influxdb::params {

class { 'influxdb::install': } ->
Expand Down
14 changes: 12 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
/386/ => "influxdb_${influxdb::version}_i386.deb",
default => "influxdb_${influxdb::version}_amd64.deb",
}
$package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}"
if $influxdb::download_url != undef {
$package_source = $influxdb::download_url
}
else {
$package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}"
}
exec {
'influxdb_wget':
command => "wget ${package_source} -O /tmp/${package_source_name}",
Expand Down Expand Up @@ -56,7 +61,12 @@
/386/ => "influxdb-${influxdb::version}-1.i686.rpm",
default => "influxdb-${influxdb::version}-1.x86_64.rpm",
}
$package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}"
if $influxdb::download_url != undef {
$package_source = $influxdb::download_url
}
else {
$package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}"
}
exec {
'influxdb_rpm':
command => "rpm -ivh ${package_source}",
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$install_from_repository = true
$config_file = '/etc/opt/influxdb/influxdb.conf'

$download_url = undef
# general section of influxdb.conf
$reporting_disabled = false

Expand All @@ -15,4 +16,5 @@

# [retention]
$retention_replication = undef

}
71 changes: 70 additions & 1 deletion spec/classes/influxdb_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'influxdb::install', :type => :class do

it { should create_class('influxdb::install') }
it { should contain_package('influxdb') }
# it { should contain_package('influxdb') }

context 'installing from a repository' do
let(:pre_condition) {
Expand Down Expand Up @@ -35,4 +35,73 @@
)}
end
end

context 'installing from web' do
context 'with default preset url' do
let(:pre_condition) {
'class{"influxdb":
ensure => "installed",
install_from_repository => false,
}'
}
context 'on Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:architecture => 'x86_64',
}
}
it { should contain_exec('influxdb_wget')
.with_command(/influxdb.s3.amazonaws/)
}
end
context 'on redhat' do
let(:facts) {
{
:osfamily => 'RedHat',
:architecture => 'x86_64',
}
}
context 'with default preset url' do
it { should contain_exec('influxdb_rpm')
.with_command(/influxdb.s3.amazonaws/)
}
end
end
end

context 'with download_url set' do
let(:pre_condition) {
'class{"influxdb":
ensure => "installed",
install_from_repository => false,
download_url => "https://download.test.com/proxy/influxdb/influxdb-1.0.0.rpm"
}'
}
context 'on Debian' do
let(:facts) {
{
:osfamily => 'Debian',
:architecture => 'x86_64',
}
}
it { should contain_exec('influxdb_wget')
.with_command(/download.test.com/)
}
end
context 'on redhat' do
let(:facts) {
{
:osfamily => 'RedHat',
:architecture => 'x86_64',
}
}
context 'with default preset url' do
it { should contain_exec('influxdb_rpm')
.with_command(/download.test.com/)
}
end
end
end
end
end