puppet 8.6.0-x64-mingw32 → 8.7.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -2
  3. data/Gemfile.lock +42 -38
  4. data/Rakefile +45 -22
  5. data/examples/hiera/README.md +68 -57
  6. data/examples/hiera/data/common.yaml +12 -0
  7. data/examples/hiera/data/dc1.yaml +6 -0
  8. data/examples/hiera/hiera.yaml +15 -0
  9. data/examples/hiera/modules/ntp/data/common.yaml +4 -0
  10. data/examples/hiera/modules/ntp/hiera.yaml +9 -0
  11. data/examples/hiera/modules/ntp/manifests/config.pp +16 -4
  12. data/examples/hiera/modules/ntp/templates/ntp.conf.epp +3 -0
  13. data/examples/hiera/modules/users/manifests/common.pp +7 -2
  14. data/examples/hiera/modules/users/manifests/dc1.pp +7 -2
  15. data/examples/hiera/site.pp +1 -1
  16. data/ext/project_data.yaml +0 -45
  17. data/lib/puppet/daemon.rb +1 -0
  18. data/lib/puppet/pops/loader/static_loader.rb +2 -2
  19. data/lib/puppet/pops/lookup/module_data_provider.rb +9 -9
  20. data/lib/puppet/provider/aix_object.rb +1 -1
  21. data/lib/puppet/provider/group/groupadd.rb +30 -9
  22. data/lib/puppet/provider/package/xbps.rb +127 -0
  23. data/lib/puppet/scheduler/splay_job.rb +9 -0
  24. data/lib/puppet/type/exec.rb +8 -0
  25. data/lib/puppet/util/command_line/trollop.rb +20 -2
  26. data/lib/puppet/util/rpm_compare.rb +1 -1
  27. data/lib/puppet/util/windows/com.rb +2 -2
  28. data/lib/puppet/version.rb +1 -1
  29. data/locales/puppet.pot +604 -600
  30. data/man/man5/puppet.conf.5 +2 -2
  31. data/man/man8/puppet-agent.8 +1 -1
  32. data/man/man8/puppet-apply.8 +1 -1
  33. data/man/man8/puppet-catalog.8 +1 -1
  34. data/man/man8/puppet-config.8 +1 -1
  35. data/man/man8/puppet-describe.8 +1 -1
  36. data/man/man8/puppet-device.8 +1 -1
  37. data/man/man8/puppet-doc.8 +1 -1
  38. data/man/man8/puppet-epp.8 +1 -1
  39. data/man/man8/puppet-facts.8 +1 -1
  40. data/man/man8/puppet-filebucket.8 +1 -1
  41. data/man/man8/puppet-generate.8 +1 -1
  42. data/man/man8/puppet-help.8 +1 -1
  43. data/man/man8/puppet-lookup.8 +1 -1
  44. data/man/man8/puppet-module.8 +1 -1
  45. data/man/man8/puppet-node.8 +1 -1
  46. data/man/man8/puppet-parser.8 +1 -1
  47. data/man/man8/puppet-plugin.8 +1 -1
  48. data/man/man8/puppet-report.8 +1 -1
  49. data/man/man8/puppet-resource.8 +1 -1
  50. data/man/man8/puppet-script.8 +1 -1
  51. data/man/man8/puppet-ssl.8 +1 -1
  52. data/man/man8/puppet.8 +2 -2
  53. metadata +39 -25
  54. data/examples/hiera/etc/hiera.yaml +0 -15
  55. data/examples/hiera/etc/hieradb/common.yaml +0 -3
  56. data/examples/hiera/etc/hieradb/dc1.yaml +0 -6
  57. data/examples/hiera/etc/hieradb/development.yaml +0 -2
  58. data/examples/hiera/etc/puppet.conf +0 -3
  59. data/examples/hiera/modules/data/manifests/common.pp +0 -4
  60. data/examples/hiera/modules/ntp/manifests/data.pp +0 -4
  61. data/examples/hiera/modules/ntp/templates/ntp.conf.erb +0 -3
  62. data/examples/hiera/modules/users/manifests/development.pp +0 -4
  63. data/tasks/benchmark.rake +0 -180
  64. data/tasks/cfpropertylist.rake +0 -15
  65. data/tasks/ci.rake +0 -24
  66. data/tasks/generate_ast_model.rake +0 -90
  67. data/tasks/generate_cert_fixtures.rake +0 -199
  68. data/tasks/manpages.rake +0 -67
  69. data/tasks/memwalk.rake +0 -195
  70. data/tasks/parallel.rake +0 -410
  71. data/tasks/parser.rake +0 -22
  72. data/tasks/yard.rake +0 -59
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c747dbaa69b82336d371f8b1ae39951b013c06cdbb2dce3e00f35c1dceb0b002
4
- data.tar.gz: 58ee771b93b07d954d4441d8aa4d2766754a3fb3bb2ef19959ca9c7b80b83c80
3
+ metadata.gz: 3e307e12a1462e76b899c9ae428ff5b76c758f3398bfd3b30ddfbd49883639bb
4
+ data.tar.gz: b0a6cd1d6bd19dc4c0cebdc3352acbc3493819c4b4f4b1e98bd0d8b4cd2632a5
5
5
  SHA512:
6
- metadata.gz: 5b8aefe46eb702c506227ae6b8d7f47960109d7a360ae248aeadd40283cecf56eda5c320a7d86e06c0d096fd2ddc2006b7e27cf2ce01e19b599e45211d8e151f
7
- data.tar.gz: bcc63456d3ee6d2c356fd26b80c1ffb173cbb045d909e2bd7cc2f4ac0275ad5b20b2333485fe3cb0a5f9007db35abe71aa7d9bca68eeaf87b2e0c0c8bcddc958
6
+ metadata.gz: fc56fba251d5749630d7e49090beeb86307e99301e95dca69902c678460613feefdf024ca01b8f20e9df4563a18466f227245b63687d9860c36d7104df892960
7
+ data.tar.gz: 89e3bb5f2fea361ab2a3b3076bc07f008275ac00a4d341e48fd63d8478b41ae9fe1b0fa8555fcef01ede3cd2f49acb61f756775c17d3f7884f7d10d34bb8eb3a
data/Gemfile CHANGED
@@ -12,7 +12,9 @@ def location_for(place, fake_version = nil)
12
12
  end
13
13
  end
14
14
 
15
- # Make sure these gem requirements are in sync with the gempspec and ext/project_data.yaml
15
+ # Make sure these gem requirements are in sync with the gempspec. Specifically,
16
+ # the runtime_dependencies in puppet.gemspec match the runtime dependencies here
17
+ # (like facter, semantic_puppet, and puppet-resource_api)
16
18
 
17
19
  gem "facter", *location_for(ENV['FACTER_LOCATION'] || ["~> 4.3"])
18
20
  gem "semantic_puppet", *location_for(ENV['SEMANTIC_PUPPET_LOCATION'] || ["~> 1.0"])
@@ -33,10 +35,12 @@ group(:features) do
33
35
  # requires native ldap headers/libs
34
36
  # gem 'ruby-ldap', '~> 0.9', require: false, platforms: [:ruby]
35
37
  gem 'puppetserver-ca', '~> 2.0', require: false
38
+ gem 'CFPropertyList', ['>= 3.0.6', '< 4'], require: false
36
39
  end
37
40
 
38
41
  group(:test) do
39
- gem "ffi", '1.15.5', require: false
42
+ # 1.16.0 - 1.16.2 are broken on Windows
43
+ gem 'ffi', '>= 1.15.5', '< 1.17.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2', require: false
40
44
  gem "json-schema", "~> 2.0", require: false
41
45
  gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~> 13.0')
42
46
  gem "rspec", "~> 3.1", require: false
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (8.6.0)
5
- CFPropertyList (~> 2.2)
4
+ puppet (8.7.0)
6
5
  concurrent-ruby (~> 1.0)
7
6
  deep_merge (~> 1.0)
8
7
  facter (>= 4.3.0, < 5)
@@ -16,17 +15,18 @@ PATH
16
15
  GEM
17
16
  remote: https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/
18
17
  specs:
19
- CFPropertyList (2.3.6)
18
+ CFPropertyList (3.0.7)
19
+ base64
20
+ nkf
21
+ rexml
20
22
  addressable (2.8.6)
21
23
  public_suffix (>= 2.0.2, < 6.0)
22
- apt_stage_artifacts (0.11.0)
23
- docopt
24
24
  artifactory (3.0.17)
25
25
  ast (2.4.2)
26
26
  base64 (0.2.0)
27
- bigdecimal (3.1.7)
27
+ bigdecimal (3.1.8)
28
28
  coderay (1.1.3)
29
- concurrent-ruby (1.2.3)
29
+ concurrent-ruby (1.3.1)
30
30
  crack (1.0.0)
31
31
  bigdecimal
32
32
  rexml
@@ -38,15 +38,16 @@ GEM
38
38
  rake (>= 12.0.0, < 14.0.0)
39
39
  docopt (0.6.1)
40
40
  erubi (1.12.0)
41
- facter (4.6.1)
41
+ facter (4.7.0)
42
42
  hocon (~> 1.3)
43
- thor (>= 1.0.1, < 2.0)
44
- faraday (2.9.0)
43
+ thor (>= 1.0.1, < 1.3)
44
+ faraday (2.9.1)
45
45
  faraday-net_http (>= 2.0, < 3.2)
46
46
  faraday-net_http (3.1.0)
47
47
  net-http
48
- fast_gettext (2.3.0)
49
- ffi (1.15.5)
48
+ fast_gettext (2.4.0)
49
+ prime
50
+ ffi (1.16.3)
50
51
  forwardable (1.3.3)
51
52
  gettext (3.4.9)
52
53
  erubi
@@ -58,7 +59,7 @@ GEM
58
59
  fast_gettext (~> 2.1)
59
60
  gettext (~> 3.4)
60
61
  locale
61
- google-apis-core (0.14.1)
62
+ google-apis-core (0.15.0)
62
63
  addressable (~> 2.5, >= 2.5.1)
63
64
  googleauth (~> 1.9)
64
65
  httpclient (>= 2.8.1, < 3.a)
@@ -66,22 +67,22 @@ GEM
66
67
  representable (~> 3.0)
67
68
  retriable (>= 2.0, < 4.a)
68
69
  rexml
69
- google-apis-iamcredentials_v1 (0.20.0)
70
- google-apis-core (>= 0.14.0, < 2.a)
71
- google-apis-storage_v1 (0.37.0)
72
- google-apis-core (>= 0.14.0, < 2.a)
70
+ google-apis-iamcredentials_v1 (0.21.0)
71
+ google-apis-core (>= 0.15.0, < 2.a)
72
+ google-apis-storage_v1 (0.39.0)
73
+ google-apis-core (>= 0.15.0, < 2.a)
73
74
  google-cloud-core (1.7.0)
74
75
  google-cloud-env (>= 1.0, < 3.a)
75
76
  google-cloud-errors (~> 1.0)
76
77
  google-cloud-env (2.1.1)
77
78
  faraday (>= 1.0, < 3.a)
78
79
  google-cloud-errors (1.4.0)
79
- google-cloud-storage (1.49.0)
80
+ google-cloud-storage (1.52.0)
80
81
  addressable (~> 2.8)
81
82
  digest-crc (~> 0.4)
82
83
  google-apis-core (~> 0.13)
83
84
  google-apis-iamcredentials_v1 (~> 0.18)
84
- google-apis-storage_v1 (~> 0.33)
85
+ google-apis-storage_v1 (~> 0.38)
85
86
  google-cloud-core (~> 1.6)
86
87
  googleauth (~> 1.9)
87
88
  mini_mime (~> 1.0)
@@ -93,10 +94,10 @@ GEM
93
94
  os (>= 0.9, < 2.0)
94
95
  signet (>= 0.16, < 2.a)
95
96
  hashdiff (1.1.0)
96
- hiera-eyaml (3.4.0)
97
- highline
98
- optimist
99
- highline (3.0.1)
97
+ hiera-eyaml (4.1.0)
98
+ highline (~> 2.1)
99
+ optimist (~> 3.1)
100
+ highline (2.1.0)
100
101
  hocon (1.4.0)
101
102
  hpricot (0.8.6)
102
103
  httpclient (2.8.3)
@@ -108,7 +109,7 @@ GEM
108
109
  language_server-protocol (3.17.0.3)
109
110
  locale (2.1.4)
110
111
  memory_profiler (1.0.1)
111
- method_source (1.0.0)
112
+ method_source (1.1.0)
112
113
  mini_mime (1.1.5)
113
114
  minitar (0.9)
114
115
  msgpack (1.7.2)
@@ -116,10 +117,10 @@ GEM
116
117
  mustache (1.1.1)
117
118
  net-http (0.4.1)
118
119
  uri
120
+ nkf (0.2.0)
119
121
  optimist (3.1.0)
120
122
  os (1.1.4)
121
- packaging (0.118.0)
122
- apt_stage_artifacts
123
+ packaging (0.120.0)
123
124
  artifactory (~> 3)
124
125
  csv (>= 3.1.5)
125
126
  google-cloud-storage
@@ -127,7 +128,7 @@ GEM
127
128
  rake (>= 12.3)
128
129
  release-metrics
129
130
  parallel (1.24.0)
130
- parser (3.3.0.5)
131
+ parser (3.3.2.0)
131
132
  ast (~> 2.4.1)
132
133
  racc
133
134
  prime (0.1.2)
@@ -146,7 +147,7 @@ GEM
146
147
  rake (13.2.1)
147
148
  rdiscount (2.2.7.3)
148
149
  rdoc (6.3.4.1)
149
- regexp_parser (2.9.0)
150
+ regexp_parser (2.9.2)
150
151
  release-metrics (1.1.0)
151
152
  csv
152
153
  docopt
@@ -155,7 +156,8 @@ GEM
155
156
  trailblazer-option (>= 0.1.1, < 0.2.0)
156
157
  uber (< 0.2.0)
157
158
  retriable (3.1.2)
158
- rexml (3.2.6)
159
+ rexml (3.2.8)
160
+ strscan (>= 3.0.9)
159
161
  ronn (0.7.3)
160
162
  hpricot (>= 0.8.2)
161
163
  mustache (>= 0.7.0)
@@ -172,11 +174,11 @@ GEM
172
174
  rspec-its (1.3.0)
173
175
  rspec-core (>= 3.0.0)
174
176
  rspec-expectations (>= 3.0.0)
175
- rspec-mocks (3.13.0)
177
+ rspec-mocks (3.13.1)
176
178
  diff-lcs (>= 1.2.0, < 2.0)
177
179
  rspec-support (~> 3.13.0)
178
180
  rspec-support (3.13.1)
179
- rubocop (1.63.0)
181
+ rubocop (1.64.1)
180
182
  json (~> 2.3)
181
183
  language_server-protocol (>= 3.17.0)
182
184
  parallel (~> 1.10)
@@ -187,8 +189,8 @@ GEM
187
189
  rubocop-ast (>= 1.31.1, < 2.0)
188
190
  ruby-progressbar (~> 1.7)
189
191
  unicode-display_width (>= 2.4.0, < 3.0)
190
- rubocop-ast (1.31.2)
191
- parser (>= 3.3.0.4)
192
+ rubocop-ast (1.31.3)
193
+ parser (>= 3.3.1.0)
192
194
  rubocop-capybara (2.20.0)
193
195
  rubocop (~> 1.41)
194
196
  rubocop-factory_bot (2.25.1)
@@ -200,12 +202,12 @@ GEM
200
202
  rubocop-ast (>= 1.31.1, < 2.0)
201
203
  rubocop-rake (0.6.0)
202
204
  rubocop (~> 1.0)
203
- rubocop-rspec (2.29.1)
205
+ rubocop-rspec (2.30.0)
204
206
  rubocop (~> 1.40)
205
207
  rubocop-capybara (~> 2.17)
206
208
  rubocop-factory_bot (~> 2.22)
207
209
  rubocop-rspec_rails (~> 2.28)
208
- rubocop-rspec_rails (2.28.2)
210
+ rubocop-rspec_rails (2.28.3)
209
211
  rubocop (~> 1.40)
210
212
  ruby-prof (1.7.0)
211
213
  ruby-progressbar (1.13.0)
@@ -217,14 +219,15 @@ GEM
217
219
  jwt (>= 1.5, < 3.0)
218
220
  multi_json (~> 1.10)
219
221
  singleton (0.2.0)
222
+ strscan (3.1.0)
220
223
  text (1.3.1)
221
- thor (1.3.1)
224
+ thor (1.2.2)
222
225
  trailblazer-option (0.1.2)
223
226
  uber (0.1.0)
224
227
  unicode-display_width (2.5.0)
225
228
  uri (0.13.0)
226
229
  vcr (6.2.0)
227
- webmock (3.23.0)
230
+ webmock (3.23.1)
228
231
  addressable (>= 2.8.0)
229
232
  crack (>= 0.3.2)
230
233
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -235,9 +238,10 @@ PLATFORMS
235
238
  x86_64-linux
236
239
 
237
240
  DEPENDENCIES
241
+ CFPropertyList (>= 3.0.6, < 4)
238
242
  diff-lcs (~> 1.3)
239
243
  facter (~> 4.3)
240
- ffi (= 1.15.5)
244
+ ffi (>= 1.15.5, < 1.17.0, != 1.16.2, != 1.16.1, != 1.16.0)
241
245
  gettext-setup (~> 1.0)
242
246
  hiera-eyaml
243
247
  hocon (~> 1.0)
data/Rakefile CHANGED
@@ -1,27 +1,9 @@
1
- # Rakefile for Puppet -*- ruby -*-
2
- RAKE_ROOT = File.dirname(__FILE__)
1
+ # frozen_string_literal: true
3
2
 
4
- # We need access to the Puppet.version method
5
- $LOAD_PATH.unshift(File.expand_path("lib"))
6
- require 'puppet/version'
7
-
8
- $LOAD_PATH << File.join(RAKE_ROOT, 'tasks')
9
-
10
- begin
11
- require 'rubygems'
12
- require 'rubygems/package_task'
13
- rescue LoadError
14
- # Users of older versions of Rake (0.8.7 for example) will not necessarily
15
- # have rubygems installed, or the newer rubygems package_task for that
16
- # matter.
17
- require 'rake/packagetask'
18
- require 'rake/gempackagetask'
19
- end
20
-
21
- require 'rake'
22
3
  require 'open3'
23
-
24
- Dir['tasks/**/*.rake'].each { |t| load t }
4
+ require 'rake'
5
+ require 'rubygems'
6
+ require 'rubygems/package_task'
25
7
 
26
8
  if Rake.application.top_level_tasks.grep(/^(pl:|package:)/).any?
27
9
  begin
@@ -45,6 +27,47 @@ task :default do
45
27
  sh %{rake -T}
46
28
  end
47
29
 
30
+ namespace :pl_ci do
31
+ desc 'Build puppet gems'
32
+ task :gem_build, [:gemspec] do |t, args|
33
+ args.with_defaults(gemspec: 'puppet.gemspec')
34
+ stdout, stderr, status = Open3.capture3(<<~END)
35
+ gem build #{args.gemspec} --platform x86-mingw32 && \
36
+ gem build #{args.gemspec} --platform x64-mingw32 && \
37
+ gem build #{args.gemspec} --platform universal-darwin && \
38
+ gem build #{args.gemspec}
39
+ END
40
+ if !status.exitstatus.zero?
41
+ puts "Error building #{args.gemspec}\n#{stdout} \n#{stderr}"
42
+ exit(1)
43
+ else
44
+ puts stdout
45
+ end
46
+ end
47
+
48
+ desc 'build the nightly puppet gems'
49
+ task :nightly_gem_build do
50
+ # this is taken from `rake package:nightly_gem`
51
+ extended_dot_version = %x{git describe --tags --dirty --abbrev=7}.chomp.tr('-', '.')
52
+
53
+ # we must create tempfile in the same directory as puppetg.gemspec, since
54
+ # it uses __dir__ to determine which files to include
55
+ require 'tempfile'
56
+ Tempfile.create('gemspec', __dir__) do |dst|
57
+ File.open('puppet.gemspec', 'r') do |src|
58
+ src.readlines.each do |line|
59
+ if line.match?(/version\s*=\s*['"][0-9.]+['"]/)
60
+ line = "spec.version = '#{extended_dot_version}'"
61
+ end
62
+ dst.puts line
63
+ end
64
+ end
65
+ dst.flush
66
+ Rake::Task['pl_ci:gem_build'].invoke(dst.path)
67
+ end
68
+ end
69
+ end
70
+
48
71
  task :spec do
49
72
  ENV["LOG_SPEC_ORDER"] = "true"
50
73
  sh %{rspec #{ENV['TEST'] || ENV['TESTS'] || 'spec'}}
@@ -1,91 +1,102 @@
1
- A working demo of Hiera with YAML and Puppet backends.
1
+ A working demo of Hiera with YAML backend.
2
2
  ======================================================
3
3
 
4
4
  This demo consists of:
5
5
 
6
- * A NTP module that has defaults for pool.ntp.org servers
7
- * A common data module where module users can create override data in pp files
8
- * A YAML data source in etc/hieradb where users can override data in yaml files
9
- * A couple of users modules that just notify the fact that they are being included
10
- * In Hiera data files a key called _classes_ that decides what to include on a node
6
+ - A **NTP** module that has defaults for *pool.ntp.org* servers
7
+ - A **YAML** data source in the *data/* directory where users can override data in yaml files
8
+ - A **Users** module that has a few manifests that simply notify that they are being included
9
+ - In Hiera data files a key called **classes** that decides what to include on a node
11
10
 
12
11
  Below various usage scenarios can be tested using this module.
13
12
 
14
- The examples below assume you have Hiera already installed and that you have
15
- hiera-puppet cloned from github and running these commands in _hiera-puppet/example_ as cwd.
13
+ The examples below assume you:
14
+ - Have the puppet-agent already installed
15
+ - You have this repository cloned from github
16
+ - Are running these commands from within the *examples/hiera* directory as cwd.
16
17
 
17
18
  Module from forge with module defaults
18
19
  --------------------------------------
19
20
 
20
- * Move the _modules/data_ directory to _modules/data.bak_ to avoid overrides
21
- used further in the example
22
- * Run puppet, creates _/etc/ntp.conf_ with ntp.org addresses
23
- * The _hiera\_include()_ function includes just _users::common_
24
-
25
- <pre>
26
- $ mv modules/data modules/data.bak
27
- $ puppet apply --config etc/puppet.conf site.pp
28
- notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/ensure: defined content as '{md5}7045121976147a932a66c7671939a9ad'
29
- notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
21
+ - Comment out lines 6-8 of [data/common.yaml](data/common.yaml#L6-8) to avoid overrides used further in the example
22
+ - Run a `puppet apply` to create a */tmp/ntp.conf* file containing the two *pool.ntp.org* addresses
23
+ - The *users::common* class should also be present in your catalog
24
+
25
+ ```shell
26
+ $ sed -i '6,8 s/^/#/' data/common.yaml
27
+ $ puppet apply site.pp --hiera_config=hiera.yaml --modulepath=modules
28
+ Notice: Compiled catalog for node.corp.com in environment production in 0.04 seconds
29
+ Notice: Adding users::common
30
+ Notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
31
+ Notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/ensure: defined content as '{sha256}949c7247dbe0870258c921418cc8b270afcc57e1aa6f9d9933f306009ede60d0'
32
+ Notice: Applied catalog in 0.02 seconds
30
33
  $ cat /tmp/ntp.conf
31
34
  server 1.pool.ntp.org
32
35
  server 2.pool.ntp.org
33
- </pre>
36
+ ```
34
37
 
35
38
  Site wide override data in _data::common_
36
39
  -----------------------------------------
37
40
 
38
- * Restore the _modules/data_ directory that has a class _data::common_ that declares site wide overrides
39
- * The _hiera_include()_ function includes just _users::common_
40
-
41
- <pre>
42
- $ mv modules/data.bak modules/data
43
- $ puppet apply --config etc/puppet.conf site.pp
44
- notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{md5}7045121976147a932a66c7671939a9addc2' to '{md5}8f9039fe1989a278a0a8e1836acb8d23'
45
- notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
41
+ - Remove the comments on lines 6-8 of [data/common.yaml](data/common.yaml#L6-8)
42
+ - Run a `puppet apply` to update */tmp/ntp.conf* to contain the two *ntp.example.com* addresses
43
+ - The *users::common* class should also be present in your catalog
44
+
45
+ ```shell
46
+ $ sed -i '6,8 s/^#//' data/common.yaml
47
+ $ puppet apply site.pp --hiera_config=hiera.yaml --modulepath=modules
48
+ Notice: Compiled catalog for node.corp.com in environment production in 0.04 seconds
49
+ Notice: Adding users::common
50
+ Notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
51
+ Notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{sha256}949c7247dbe0870258c921418cc8b270afcc57e1aa6f9d9933f306009ede60d0' to '{sha256}28ced955a8ed9efd7514b2364fe378ba645ab947f26e8c0b4d84e8368f1257a0'
52
+ Notice: Applied catalog in 0.02 seconds
46
53
  $ cat /tmp/ntp.conf
47
54
  server ntp1.example.com
48
55
  server ntp2.example.com
49
- </pre>
56
+ ```
50
57
 
51
58
  Fact driven overrides for location=dc1
52
59
  --------------------------------------
53
60
 
54
- * Set a fact location=dc1 that uses the YAML data in _etc/hieradb/dc1.yaml_ to override
55
- * Show that machines in dc2 would use site-wide defaults
56
- * The _hiera_include()_ function includes _users::common_ and _users::dc1_ as the data file for dc1 adds that
57
-
58
- <pre>
59
- $ FACTER_location=dc1 puppet apply --config etc/puppet.conf site.pp
60
- notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{md5}8f9039fe1989a278a0a8e1836acb8d23' to '{md5}074d0e2ac727f6cb9afe3345d574b578'
61
- notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
62
- notice: /Stage[main]/Users::Dc1/Notify[Adding users::dc1]/message: defined 'message' as 'Adding users::dc1'
61
+ - Override the location fact to `dc1` to demonstrate *data/dc1.yaml* overrides the *ntp::config::ntpservers* values in *data/common.yaml*
62
+ - `dc1` nodes will
63
+ - have the *users::common* and *users::dc1* in their catalogs
64
+ - */tmp/ntp.conf* will contain the two *ntp.dc1.example.com* addresses
65
+ - Show that the nodes in `dc2` would use the site-wide defaults
66
+
67
+ ```shell
68
+ $ FACTER_location=dc1 puppet apply site.pp --hiera_config=hiera.yaml --modulepath=modules
69
+ Notice: Compiled catalog for node.corp.com in environment production in 0.04 seconds
70
+ Notice: Adding users::dc1
71
+ Notice: /Stage[main]/Users::Dc1/Notify[Adding users::dc1]/message: defined 'message' as 'Adding users::dc1'
72
+ Notice: Adding users::common
73
+ Notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
74
+ Notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{sha256}28ced955a8ed9efd7514b2364fe378ba645ab947f26e8c0b4d84e8368f1257a0' to '{sha256}39227f1cf8d09623d2e66b6622af2e8db01ab26f77a5a2e6d6e058d0977f369b'
75
+ Notice: Applied catalog in 0.02 seconds
63
76
  $ cat /tmp/ntp.conf
64
77
  server ntp1.dc1.example.com
65
78
  server ntp2.dc1.example.com
66
- </pre>
67
-
68
- Now simulate a machine in _dc2_, because there is no data for dc2 it uses the site wide defaults and
69
- does not include the _users::dc1_ class anymore
70
-
71
- <pre>
72
- $ FACTER_location=dc2 puppet apply --config etc/puppet.conf site.pp
73
- warning: Could not find class data::dc2 for nephilim.ml.org
74
- notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{md5}074d0e2ac727f6cb9afe3345d574b578' to '{md5}8f9039fe1989a278a0a8e1836acb8d23'
75
- notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
79
+ ```
80
+
81
+ Now simulate a machine in `dc2`, because there is no data for `dc2` it uses the site wide defaults and
82
+ does not include the *users::dc1* class anymore
83
+
84
+ ```shell
85
+ $ FACTER_location=dc2 puppet apply site.pp --hiera_config=hiera.yaml --modulepath=modules
86
+ Notice: Compiled catalog for node.corp.com in environment production in 0.04 seconds
87
+ Notice: Adding users::common
88
+ Notice: /Stage[main]/Users::Common/Notify[Adding users::common]/message: defined 'message' as 'Adding users::common'
89
+ Notice: /Stage[main]/Ntp::Config/File[/tmp/ntp.conf]/content: content changed '{sha256}39227f1cf8d09623d2e66b6622af2e8db01ab26f77a5a2e6d6e058d0977f369b' to '{sha256}28ced955a8ed9efd7514b2364fe378ba645ab947f26e8c0b4d84e8368f1257a0'
90
+ Notice: Applied catalog in 0.02 seconds
76
91
  $ cat /tmp/ntp.conf
77
92
  server ntp1.example.com
78
93
  server ntp2.example.com
79
- </pre>
94
+ ```
80
95
 
81
- You could create override data in the following places for a machine in _location=dc2_, they will be searched in this order and the first one with data will match.
96
+ You could create override data in the following places for a machine in *location=dc2*, they will be searched in this order and the first one with data will match.
82
97
 
83
- * file etc/hieradb/dc2.yaml
84
- * file etc/hieradb/common.yaml
85
- * class data::dc2
86
- * class data::production
87
- * class data::common
88
- * class ntp::config::data
89
- * class ntp::data
98
+ - file data/dc2.yaml
99
+ - file data/&lt;environment&gt;.yaml
100
+ - file data/common.yaml
90
101
 
91
- In this example due to the presence of _common.yaml_ that declares _ntpservers_ the classes will never be searched, it will have precedence.
102
+ In this example due to the presence of *common.yaml* that declares *ntpservers* the classes will never be searched, it will have precedence.
@@ -0,0 +1,12 @@
1
+ ---
2
+ classes:
3
+ - users::common
4
+ - ntp::config
5
+
6
+ ntp::config::ntpservers:
7
+ - 'ntp1.example.com'
8
+ - 'ntp2.example.com'
9
+
10
+ lookup_options:
11
+ classes:
12
+ merge: unique
@@ -0,0 +1,6 @@
1
+ ---
2
+ ntp::config::ntpservers:
3
+ - 'ntp1.dc1.example.com'
4
+ - 'ntp2.dc1.example.com'
5
+ classes:
6
+ - users::dc1
@@ -0,0 +1,15 @@
1
+ ---
2
+ version: 5
3
+ defaults:
4
+ datadir: data
5
+ data_hash: yaml_data
6
+
7
+ hierarchy:
8
+ - name: 'Per Location'
9
+ path: "%{facts.location}.yaml"
10
+
11
+ - name: 'Per Environment'
12
+ path: "%{facts.environment}.yaml"
13
+
14
+ - name: 'Common Data'
15
+ path: 'common.yaml'
@@ -0,0 +1,4 @@
1
+ ---
2
+ ntp::config::ntpservers:
3
+ - '1.pool.ntp.org'
4
+ - '2.pool.ntp.org'
@@ -0,0 +1,9 @@
1
+ ---
2
+ version: 5
3
+ defaults:
4
+ datadir: data
5
+ data_hash: yaml_data
6
+
7
+ hierarchy:
8
+ - name: 'Common Data'
9
+ path: 'common.yaml'
@@ -1,6 +1,18 @@
1
- # lookup ntpservers from hiera, or allow user of class to provide other value
2
- class ntp::config($ntpservers = hiera('ntpservers')) {
3
- file{'/tmp/ntp.conf':
4
- content => template('ntp/ntp.conf.erb')
1
+ # @summary Manage /tmp/ntp.conf file
2
+ #
3
+ # Given an array of ntpservers, manage the /tmp/ntp.conf file
4
+ #
5
+ # @example
6
+ # include ntp::config
7
+ #
8
+ # @param ntpservers
9
+ # An array of ntpserver(s) that should be present in the conf file
10
+ class ntp::config(
11
+ Array[String[1], 1] $ntpservers = undef,
12
+ ) {
13
+
14
+ file { '/tmp/ntp.conf':
15
+ content => epp('ntp/ntp.conf.epp')
5
16
  }
17
+
6
18
  }
@@ -0,0 +1,3 @@
1
+ <% $ntp::config::ntpservers.each |$server| { -%>
2
+ server <%= $server %>
3
+ <% } -%>
@@ -1,4 +1,9 @@
1
- # notifies
1
+ # @summary Notify to demonstrate users::common in catalog
2
+ #
3
+ # A common Class that all examples should include
4
+ #
5
+ # @example
6
+ # include users::common
2
7
  class users::common {
3
- notify{'Adding users::common': }
8
+ notify { 'Adding users::common': }
4
9
  }
@@ -1,4 +1,9 @@
1
- # notifies
1
+ # @summary Notify to demonstrate users::dc1 in catalog
2
+ #
3
+ # A Class that should be present in dc1 node(s) catalog
4
+ #
5
+ # @example
6
+ # include users::dc1
2
7
  class users::dc1 {
3
- notify{'Adding users::dc1': }
8
+ notify { 'Adding users::dc1': }
4
9
  }
@@ -1,3 +1,3 @@
1
1
  node default {
2
- hiera_include('classes')
2
+ include lookup('classes')
3
3
  }