Browse Source

Restructure Hiera data

DarkMorford 6 years ago
parent
commit
2406a0c32d
5 changed files with 33 additions and 7 deletions
  1. 1 1
      data/os/Debian.yaml
  2. 8 4
      hiera.yaml
  3. 22 0
      manifests/init.pp
  4. 1 1
      spec/classes/install_spec.rb
  5. 1 1
      spec/classes/service_spec.rb

+ 1 - 1
data/os/Debian.yaml

@@ -26,4 +26,4 @@ nginx::error_log:  '/var/log/nginx/error.log'
 
 
 # HTTP Gzip section
 # HTTP Gzip section
 nginx::gzip: 'on'
 nginx::gzip: 'on'
-nginx::gzip_disable: 'msie6'
+nginx::gzip_disable: ['msie6']

+ 8 - 4
hiera.yaml

@@ -6,8 +6,12 @@ defaults:  # Used for any hierarchy level that omits these keys.
   data_hash: yaml_data  # Use the built-in YAML backend.
   data_hash: yaml_data  # Use the built-in YAML backend.
 
 
 default_hierarchy:
 default_hierarchy:
-  - name: "OS Family"
-    path: "os/%{facts.os.family}.yaml"
+  - name: "Operating System"
+    paths:
+      - "os/%{facts.os.name}-%{facts.os.distro.codename}.yaml"
+      - "os/%{facts.os.name}.yaml"
+      - "os/family/%{facts.os.family}.yaml"
 
 
-  - name: 'common'
-    path: 'common.yaml'
+  - name: "common"
+    paths:
+      - "common.yaml"

+ 22 - 0
manifests/init.pp

@@ -7,6 +7,28 @@
 class nginx (
 class nginx (
   String $server_package,
   String $server_package,
   String $server_service,
   String $server_service,
+
+  String                         $user,
+  Variant[Enum['auto'], Integer] $worker_processes,
+  String                         $pid,
+
+  Integer $worker_connections,
+
+  Nginx::NginxBool         $sendfile,
+  Nginx::NginxBool         $tcp_nopush,
+  Nginx::NginxBool         $tcp_nodelay,
+  Variant[Integer, String] $keepalive_timeout,
+  Integer                  $types_hash_max_size,
+  String                   $default_type,
+
+  Array[String]    $ssl_protocols,
+  Nginx::NginxBool $ssl_prefer_server_ciphers,
+
+  String $access_log,
+  String $error_log,
+
+  Nginx::NginxBool $gzip,
+  Array[String]    $gzip_disable,
 ) {
 ) {
   contain 'nginx::install'
   contain 'nginx::install'
   contain 'nginx::service'
   contain 'nginx::service'

+ 1 - 1
spec/classes/install_spec.rb

@@ -8,7 +8,7 @@ describe 'nginx::install' do
 
 
       it { is_expected.to compile.with_all_deps }
       it { is_expected.to compile.with_all_deps }
 
 
-      case os_facts[:osfamily]
+      case os_facts[:'os::family']
       when 'Debian'
       when 'Debian'
         it { is_expected.to contain_package('nginx').with_ensure('installed') }
         it { is_expected.to contain_package('nginx').with_ensure('installed') }
       end
       end

+ 1 - 1
spec/classes/service_spec.rb

@@ -8,7 +8,7 @@ describe 'nginx::service' do
 
 
       it { is_expected.to compile.with_all_deps }
       it { is_expected.to compile.with_all_deps }
 
 
-      case os_facts[:osfamily]
+      case os_facts[:'os::family']
       when 'Debian'
       when 'Debian'
         it do
         it do
           is_expected.to contain_service('nginx').with(
           is_expected.to contain_service('nginx').with(