diff --git a/.fixtures.yml b/.fixtures.yml index d565dc3..8a22260 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -7,11 +7,13 @@ fixtures: yumrepo: "puppetlabs/yumrepo_core" apt: "puppetlabs/apt" repositories: + bootstrap: 'https://github.com/puppetlabs/puppetlabs-bootstrap' + deploy_pe: 'https://github.com/jarretlavallee/puppet-deploy_pe' facts: 'https://github.com/puppetlabs/puppetlabs-facts' - puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent' provision: 'https://github.com/puppetlabs/provision' - bootstrap: 'https://github.com/puppetlabs/puppetlabs-bootstrap' + puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent' puppet_conf: 'https://github.com/puppetlabs/puppetlabs-puppet_conf' ruby_task_helper: 'https://git@github.com/puppetlabs/puppetlabs-ruby_task_helper' stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib' - deploy_pe: 'https://github.com/jarretlavallee/puppet-deploy_pe' + symlinks: + influxdb: "#{source_dir}" # for custom type(s) diff --git a/data/common.yaml b/data/common.yaml index 54b37d0..c5f6015 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -6,3 +6,4 @@ 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 +influxdb::profile::toml::version: '2.1.1' diff --git a/manifests/init.pp b/manifests/init.pp index 026a511..4a4f651 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,5 @@ # @summary Installs, configures, and performs initial setup of InfluxDB 2.x +# # @example Basic usage # include influxdb # @@ -6,6 +7,7 @@ # initial_org => 'my_org', # initial_bucket => 'my_bucket', # } +# # @param manage_repo # Whether to manage a repository to provide InfluxDB packages. Defaults to true # @param manage_setup diff --git a/manifests/profile/toml.pp b/manifests/profile/toml.pp index 74f250f..4e58749 100644 --- a/manifests/profile/toml.pp +++ b/manifests/profile/toml.pp @@ -1,9 +1,16 @@ # @summary Installs the toml-rb gem inside Puppet server +# +# @param version +# Specific version of toml-rb gem +# # @example Basic usage # include influxdb::profile::toml +# + +# class influxdb::profile::toml ( - String $version = '2.1.1', -){ + String $version, +) { $service_name = $facts['pe_server_version'] ? { undef => 'puppetserver', default => 'pe-puppetserver', diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index caf1972..31bbe5b 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -9,6 +9,17 @@ let(:facts) { os_facts } it { is_expected.to compile } + + it { + is_expected.to contain_influxdb_setup(Facter.value(:networking)['fqdn']).with( + ensure: 'present', + token_file: '/root/.influxdb_token', + bucket: 'puppet_data', + org: 'puppetlabs', + username: 'admin', + password: RSpec::Puppet::Sensitive.new('puppetlabs'), + ).that_requires('Service[influxdb]') + } end end @@ -18,7 +29,6 @@ it { is_expected.to contain_class('influxdb').with( host: 'localhost', - port: 8086, use_ssl: true, initial_org: 'puppetlabs', token: nil, @@ -61,7 +71,9 @@ is_expected.to contain_class('influxdb').with(use_ssl: false) is_expected.not_to contain_file('/etc/influxdb/cert.pem') + is_expected.not_to contain_file('/etc/influxdb/ca.pem') + is_expected.not_to contain_file('/etc/influxdb/key.pem') } end @@ -98,11 +110,13 @@ group: 'root', ) end + is_expected.to contain_file('/var/lib/influxdb').with( ensure: 'directory', owner: 'influxdb', group: 'influxdb', ) + is_expected.to contain_file('/var/lib/influxdb').that_requires(['User[influxdb]', 'Group[influxdb]']) ['/etc/influxdb/scripts/influxd-systemd-start.sh', '/etc/systemd/system/influxdb.service'].each do |file| @@ -110,11 +124,13 @@ end is_expected.to contain_user('influxdb') + is_expected.to contain_group('influxdb') is_expected.to contain_archive('/tmp/influxdb.tar.gz').with( source: 'https://dl.influxdata.com/influxdb/releases/influxdb2-2.1.1-linux-amd64.tar.gz', ) + is_expected.to contain_archive('/tmp/influxdb.tar.gz').that_requires( ['File[/etc/influxdb]', 'File[/opt/influxdb]'], ) @@ -126,6 +142,7 @@ it { is_expected.not_to contain_yumrepo('influxdb2') + is_expected.not_to contain_archive('/tmp/influxdb.tar.gz') } end