Skip to content

Commit

Permalink
Merge pull request #21 from syseleven/use-module-hiera-data
Browse files Browse the repository at this point in the history
Switch to module hiera data values
  • Loading branch information
bastelfreak committed Mar 31, 2023
2 parents a0c175f + c4495b6 commit 77bf440
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 96 deletions.
11 changes: 0 additions & 11 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#### Public Classes

* [`opensearch`](#opensearch): Module to manage opensearch.
* [`opensearch::params`](#opensearch--params): Default values.

#### Private Classes

Expand Down Expand Up @@ -92,16 +91,12 @@ Data type: `Enum['x64', 'arm64']`

The architecture for the package.

Default value: `$opensearch::params::package_architecture`

##### <a name="-opensearch--package_provider"></a>`package_provider`

Data type: `Enum['dpkg', 'rpm']`

The provider for the package to be used to install the package.

Default value: `$opensearch::params::package_provider`

##### <a name="-opensearch--package_directory"></a>`package_directory`

Data type: `Stdlib::Absolutepath`
Expand Down Expand Up @@ -132,8 +127,6 @@ Data type: `Hash`

The modules default settings for opensearch.

Default value: `$opensearch::params::default_settings`

##### <a name="-opensearch--settings"></a>`settings`

Data type: `Hash`
Expand Down Expand Up @@ -222,7 +215,3 @@ Data type: `Stdlib::HTTPUrl`

Default value: `'https://artifacts.opensearch.org/publickeys/opensearch.pgp'`

### <a name="opensearch--params"></a>`opensearch::params`

Default values.

2 changes: 2 additions & 0 deletions data/architecture/arm64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
opensearch::package_architecture: 'arm64'
2 changes: 2 additions & 0 deletions data/architecture/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
opensearch::package_architecture: 'x64'
49 changes: 48 additions & 1 deletion data/common.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
--- {}
---
opensearch::default_settings:
cluster.name: 'opensearch'
cluster.initial_cluster_manager_nodes: "%{facts.networking.hostname}"
discovery.seed_hosts:
- '127.0.0.1'
gateway.recover_after_nodes: 0
http.port: 9200
network.host: '127.0.0.1'
node.max_local_storage_nodes: 3
node.name: "%{facts.networking.hostname}"
path.data: '/var/lib/opensearch'
path.logs: '/var/log/opensearch'
plugins.security.allow_default_init_securityindex: true
plugins.security.allow_unsafe_democertificates: true
plugins.security.audit.type: 'internal_opensearch'
plugins.security.authcz.admin_dn:
- 'CN=kirk,OU=client,O=client,L=test, C=de'
plugins.security.check_snapshot_restore_write_privileges: true
plugins.security.disabled: false
plugins.security.enable_snapshot_restore_privilege: true
plugins.security.restapi.roles_enabled:
- 'all_access'
- 'security_rest_api_access'
plugins.security.ssl.http.enabled: true
plugins.security.ssl.http.pemcert_filepath: 'esnode.pem'
plugins.security.ssl.http.pemkey_filepath: 'esnode-key.pem'
plugins.security.ssl.http.pemtrustedcas_filepath: 'root-ca.pem'
plugins.security.ssl.transport.enforce_hostname_verification: false
plugins.security.ssl.transport.pemcert_filepath: 'esnode.pem'
plugins.security.ssl.transport.pemkey_filepath: 'esnode-key.pem'
plugins.security.ssl.transport.pemtrustedcas_filepath: 'root-ca.pem'
plugins.security.system_indices.enabled: true
plugins.security.system_indices.indices:
- '.plugins-ml-model'
- '.plugins-ml-task'
- '.opendistro-alerting-config'
- '.opendistro-alerting-alert*'
- '.opendistro-anomaly-results*'
- '.opendistro-anomaly-detector*'
- '.opendistro-anomaly-checkpoints'
- '.opendistro-anomaly-detection-state'
- '.opendistro-reports-*'
- '.opensearch-notifications-*'
- '.opensearch-notebooks'
- '.opensearch-observability'
- '.opendistro-asynchronous-search-response*'
- '.replication-metadata-store'
2 changes: 2 additions & 0 deletions data/os/Debian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
opensearch::package_provider: 'dpkg'
2 changes: 2 additions & 0 deletions data/os/RedHat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
opensearch::package_provider: 'rpm'
14 changes: 8 additions & 6 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
---
version: 5

defaults: # Used for any hierarchy level that omits these keys.
defaults: # Used for any hierarchy level that omits these keys.
datadir: data # This path is relative to hiera.yaml's directory.
data_hash: yaml_data # Use the built-in YAML backend.

hierarchy:
- name: "archicture"
paths:
- "architecture/%{facts.os.architecture}.yaml"
- "architecture/common.yaml"
- name: "osfamily/major release"
paths:
# Used to distinguish between Debian and Ubuntu
- "os/%{facts.os.name}/%{facts.os.release.major}.yaml"
- "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
# Used for Solaris
- "os/%{facts.os.family}/%{facts.kernelrelease}.yaml"
- "os/%{facts.os.name}/%{facts.os.release.major}.yaml" # Used to distinguish between Debian and Ubuntu
- "os/%{facts.os.family}/%{facts.os.release.major}.yaml" #
- "os/%{facts.os.family}/%{facts.kernelrelease}.yaml" # Used for Solaris
- name: "osfamily"
paths:
- "os/%{facts.os.name}.yaml"
Expand Down
9 changes: 5 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
# Restart the service on package changes
#
class opensearch (
Enum['x64', 'arm64'] $package_architecture,
Enum['dpkg', 'rpm'] $package_provider,
Hash $default_settings,

##
## version
##
Expand All @@ -50,10 +54,8 @@
## package values
##
Boolean $manage_package = true,
Enum['x64', 'arm64'] $package_architecture = $opensearch::params::package_architecture,
Stdlib::Absolutepath $package_directory = '/opt/opensearch',
Enum['present', 'absent'] $package_ensure = 'present',
Enum['dpkg', 'rpm'] $package_provider = $opensearch::params::package_provider,
Enum['archive', 'download', 'repository'] $package_source = 'repository',

##
Expand All @@ -69,7 +71,6 @@
##
Boolean $manage_config = true,
Boolean $use_default_settings = true,
Hash $default_settings = $opensearch::params::default_settings,
Hash $settings = {},

##
Expand All @@ -85,7 +86,7 @@
Boolean $service_enable = true,
Boolean $restart_on_config_change = true,
Boolean $restart_on_package_change = true,
) inherits opensearch::params {
) {
contain opensearch::install
contain opensearch::config
contain opensearch::service
Expand Down
70 changes: 0 additions & 70 deletions manifests/params.pp

This file was deleted.

4 changes: 0 additions & 4 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
is_expected.to contain_class('opensearch')
}

it {
is_expected.to contain_class('opensearch::params')
}

include_examples 'config', parameter, facts
include_examples 'install', parameter, facts
include_examples 'service', parameter, facts
Expand Down

0 comments on commit 77bf440

Please sign in to comment.