@@ -0,0 +1,2 @@
+---
+nginx::server_package: 'nginx'
@@ -5,6 +5,9 @@ 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:
+default_hierarchy:
+ - name: "OS Family"
+ path: "os/%{facts.os.family}.yaml"
+
- name: 'common'
path: 'common.yaml'
@@ -0,0 +1,13 @@
+# A description of what this class does
+#
+# @summary A short summary of the purpose of this class
+# @example
+# include nginx
+class nginx (
+ String $server_package,
+) {
+ package { $server_package:
+ ensure => installed,
+ }
+}
@@ -12,14 +12,14 @@
"operatingsystem": "Debian",
"operatingsystemrelease": [
"8",
- "9"
+ "9"
]
},
{
"operatingsystem": "Ubuntu",
"16.04",
- "18.04"
+ "18.04"
}
],
@@ -0,0 +1,16 @@
+require 'spec_helper'
+describe 'nginx' do
+ on_supported_os.each do |os, os_facts|
+ context "on #{os}" do
+ let(:facts) { os_facts }
+ it { is_expected.to compile.with_all_deps }
+ case facts[:osfamily]
+ when 'Debian'
+ it { is_expected.to contain_package('nginx') }
+ end
+end