onceover 3.21.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/devcontainer.json +4 -6
  3. data/.github/dependabot.yml +17 -0
  4. data/.github/workflows/release.yaml +32 -0
  5. data/.github/workflows/tests.yaml +30 -4
  6. data/.gitignore +2 -1
  7. data/.rubocop.yml +4 -704
  8. data/.rubocop_todo.yml +828 -0
  9. data/CHANGELOG.md +1036 -0
  10. data/Gemfile +9 -0
  11. data/LICENSE +202 -0
  12. data/README.md +122 -32
  13. data/Rakefile +24 -14
  14. data/cucumber.yml +1 -0
  15. data/features/auto_vendored.feature +27 -0
  16. data/features/step_definitions/common.rb +5 -5
  17. data/features/step_definitions/run.rb +4 -0
  18. data/features/support/cache_helper.rb +0 -1
  19. data/features/support/command_helper.rb +0 -2
  20. data/features/support/controlrepo_helper.rb +0 -2
  21. data/features/zzz_run.feature +1 -8
  22. data/lib/onceover/beaker/spec_helper.rb +9 -9
  23. data/lib/onceover/beaker.rb +9 -12
  24. data/lib/onceover/cli/run.rb +1 -0
  25. data/lib/onceover/controlrepo.rb +22 -27
  26. data/lib/onceover/deploy.rb +30 -3
  27. data/lib/onceover/group.rb +1 -3
  28. data/lib/onceover/logger.rb +3 -3
  29. data/lib/onceover/node.rb +0 -2
  30. data/lib/onceover/rake_tasks.rb +9 -4
  31. data/lib/onceover/rspec/formatters.rb +5 -8
  32. data/lib/onceover/runner.rb +1 -1
  33. data/lib/onceover/test.rb +2 -3
  34. data/lib/onceover/testconfig.rb +2 -2
  35. data/lib/onceover/vendored_modules.rb +186 -0
  36. data/onceover.gemspec +26 -30
  37. data/spec/fixtures/controlrepos/caching/spec/factsets/README.md +1 -1
  38. data/spec/fixtures/controlrepos/caching/spec/pre_conditions/README.md +1 -1
  39. data/spec/fixtures/controlrepos/factsets/spec/factsets/README.md +1 -1
  40. data/spec/fixtures/controlrepos/puppet_controlrepo/.atom-build.json +9 -0
  41. data/spec/fixtures/controlrepos/puppet_controlrepo/.gitignore +5 -0
  42. data/spec/fixtures/controlrepos/puppet_controlrepo/.ruby-version +1 -0
  43. data/spec/fixtures/controlrepos/puppet_controlrepo/.travis.yml +13 -0
  44. data/spec/fixtures/controlrepos/puppet_controlrepo/Gemfile +22 -0
  45. data/spec/fixtures/controlrepos/puppet_controlrepo/Jenkinsfile +50 -0
  46. data/spec/fixtures/controlrepos/puppet_controlrepo/Puppetfile +102 -0
  47. data/spec/fixtures/controlrepos/puppet_controlrepo/README.md +4 -0
  48. data/spec/fixtures/controlrepos/puppet_controlrepo/Rakefile +6 -0
  49. data/spec/fixtures/controlrepos/puppet_controlrepo/data/common.yaml +558 -0
  50. data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/melbourne.yaml +12 -0
  51. data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/singapore.yaml +12 -0
  52. data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/development.yaml +3 -0
  53. data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/production.yaml +3 -0
  54. data/spec/fixtures/controlrepos/puppet_controlrepo/data/size/vol.large.yaml +27 -0
  55. data/spec/fixtures/controlrepos/puppet_controlrepo/environment.conf +3 -0
  56. data/spec/fixtures/controlrepos/puppet_controlrepo/hiera.yaml +25 -0
  57. data/spec/fixtures/controlrepos/puppet_controlrepo/manifests/site.pp +11 -0
  58. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/code_manager_config_version.rb +19 -0
  59. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.rb +25 -0
  60. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.sh +12 -0
  61. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/count_changed_classes.rb +26 -0
  62. data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/get_changed_classes.rb +26 -0
  63. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/functions/user/token.pp +10 -0
  64. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/init.pp +14 -0
  65. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/user.pp +35 -0
  66. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/lib/puppet/functions/deployments/generate.rb +15 -0
  67. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/plans/signed_deployment.pp +126 -0
  68. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/facts.d/test.sh +2 -0
  69. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/artifactory/config_descriptor.xml +265 -0
  70. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/autosign.sh +23 -0
  71. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/hudson.tasks.Shell.xml +4 -0
  72. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/motd +4 -0
  73. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/polar_clock/index.html +198 -0
  74. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/apt.pp +9 -0
  75. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/aws_nodes.pp +54 -0
  76. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/aws.pp +9 -0
  77. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/rhel.pp +50 -0
  78. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows/hardening.pp +57 -0
  79. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows.pp +52 -0
  80. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base.pp +79 -0
  81. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/artifactory.pp +64 -0
  82. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/connection.pp +95 -0
  83. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/haproxy.pp +65 -0
  84. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/replicated.pp +53 -0
  85. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/balancer.pp +28 -0
  86. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/master.pp +19 -0
  87. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/host_record.pp +16 -0
  88. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/server.pp +66 -0
  89. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/docker.pp +5 -0
  90. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/base.pp +43 -0
  91. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core/database_connection.pp +42 -0
  92. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core.pp +72 -0
  93. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/ctrl.pp +57 -0
  94. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/database.pp +32 -0
  95. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/exec.pp +11 -0
  96. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/client.pp +165 -0
  97. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/master_patch.pp +37 -0
  98. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/grafana/dashboard.pp +17 -0
  99. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/haproxy.pp +43 -0
  100. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/init.pp +3 -0
  101. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins/plugins.pp +87 -0
  102. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins.pp +65 -0
  103. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/aio.pp +39 -0
  104. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/app.pp +27 -0
  105. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/db.pp +25 -0
  106. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd/compile.pp +82 -0
  107. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd.pp +28 -0
  108. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/dashboard.pp +28 -0
  109. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/mysql_server.pp +7 -0
  110. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/nginx.pp +24 -0
  111. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/polar_clock.pp +55 -0
  112. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/api_auth.pp +82 -0
  113. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/autosign.pp +33 -0
  114. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/aws.pp +58 -0
  115. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/tuning.pp +139 -0
  116. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster.pp +139 -0
  117. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/rvm.pp +13 -0
  118. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sumologic.pp +11 -0
  119. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sunburst/windows.pp +104 -0
  120. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/vagrant.pp +25 -0
  121. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/windows/webserver.pp +27 -0
  122. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/cd4pe/connection_script.sh.epp +110 -0
  123. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/controlrepo_deploy_jenkins_job.xml.epp +51 -0
  124. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/dashboard.json.epp +403 -0
  125. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/jenkins_secret_text.json.epp +1 -0
  126. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/onceover_jenkins_job.xml.epp +51 -0
  127. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/userdata.epp +17 -0
  128. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/cd4pe.pp +29 -0
  129. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/clock.pp +16 -0
  130. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/balancer.pp +5 -0
  131. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/master.pp +5 -0
  132. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/aio.pp +10 -0
  133. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/controller.pp +10 -0
  134. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/database.pp +7 -0
  135. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/exec.pp +6 -0
  136. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/init.pp +3 -0
  137. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/lb.pp +14 -0
  138. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/metrics.pp +5 -0
  139. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/mysql.pp +13 -0
  140. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/base.pp +5 -0
  141. data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/webserver.pp +6 -0
  142. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/.gitignore +5 -0
  143. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/acceptance/nodesets/onceover-nodes.yml +94 -0
  144. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/classes/test_spec.rb +8 -0
  145. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master-2017.3.2.json +531 -0
  146. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master.json +429 -0
  147. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64.json +353 -0
  148. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2008r2-64.json +184 -0
  149. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2012r2-64.json +165 -0
  150. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/hiera.yaml +18 -0
  151. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/matchers/file_matchers.rb +16 -0
  152. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/onceover.yaml +54 -0
  153. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/pre_conditions/site.pp +150 -0
  154. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/r10k.yaml +2 -0
  155. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/shared_examples/helper.rb +91 -0
  156. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/00_parse_spec.rb +76 -0
  157. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/01_linting_spec_example.rb +69 -0
  158. data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/03_puppetfile_spec_example.rb +35 -0
  159. data/spec/fixtures/controlrepos/vendored/Puppetfile +3 -0
  160. data/spec/fixtures/controlrepos/vendored/Puppetfile.cron +5 -0
  161. data/spec/fixtures/controlrepos/vendored/environment.conf +1 -0
  162. data/spec/fixtures/controlrepos/vendored/site-modules/role/manifests/cron.pp +9 -0
  163. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-7.30.0.json +1 -0
  164. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-8.6.0.json +1 -0
  165. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-7.30.0.json +1 -0
  166. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-8.6.0.json +1 -0
  167. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-7.30.0.json +1 -0
  168. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-8.6.0.json +1 -0
  169. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-7.30.0.json +1 -0
  170. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-8.6.0.json +1 -0
  171. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-7.30.0.json +1 -0
  172. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-8.6.0.json +1 -0
  173. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-7.30.0.json +1 -0
  174. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-8.6.0.json +1 -0
  175. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-7.30.0.json +1 -0
  176. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-8.6.0.json +1 -0
  177. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-7.30.0.json +1 -0
  178. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-8.6.0.json +1 -0
  179. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-7.30.0.json +1 -0
  180. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-8.6.0.json +1 -0
  181. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-7.30.0.json +1 -0
  182. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-8.6.0.json +1 -0
  183. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-7.30.0.json +1 -0
  184. data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-8.6.0.json +1 -0
  185. data/spec/onceover/controlrepo_spec.rb +1 -1
  186. data/templates/factsets_README.md.erb +1 -1
  187. data/templates/pre_conditions_README.md.erb +1 -1
  188. data/templates/spec_helper.rb.erb +0 -2
  189. data/templates/test_spec.rb.erb +3 -0
  190. metadata +173 -68
  191. data/.gitmodules +0 -4
@@ -0,0 +1,165 @@
1
+ # Sets up file sync on an arbitrary host
2
+ # --------------------------------------
3
+ #
4
+ # This class installs the pe-puppetserver service in a customised configuration
5
+ # which means that it only runs the file sync client service, no jrubies, no file
6
+ # server etc. This can be installed on any hosts that for whatever reason need an
7
+ # up-to-date copy of the Puppet code without having to create a new mechanism to
8
+ # keep it in sync
9
+ #
10
+ # @param puppetserver_conf_dir Directory where config files are written
11
+ # @param enable_gc_logging Whether garbage collection should be logged
12
+ # @param code_dir Where to sync the code
13
+ # @param java_args Java arguments for the pe-puppetserver process
14
+ #
15
+ class profile::file_sync::client (
16
+ $puppetserver_conf_dir = '/etc/puppetlabs/puppetserver/conf.d',
17
+ $enable_gc_logging = true,
18
+ $code_dir = '/etc/puppetlabs/code',
19
+ $java_args = {
20
+ 'Xmx' => '256m',
21
+ 'Xms' => '256m',
22
+ },
23
+ ) {
24
+ # Set defaults that all settings are for puppetserver
25
+ Puppet_enterprise::Trapperkeeper::Bootstrap_cfg {
26
+ container => 'puppetserver',
27
+ }
28
+
29
+ # Install all packages required
30
+ Package <| tag == 'pe-master-packages' |>
31
+
32
+ # Ensure that the pe-puppetserver service is managed
33
+ puppet_enterprise::trapperkeeper::pe_service { 'puppetserver': }
34
+
35
+ # Remove all config files after install to get rid of default stuff
36
+ exec { 'remove default config':
37
+ command => "rm -rf ${puppetserver_conf_dir}/*",
38
+ path => $facts['path'],
39
+ refreshonly => true,
40
+ subscribe => Package['pe-puppetserver'],
41
+ }
42
+
43
+ # Ensure that all hocon settings come after the exec
44
+ Exec['remove default config'] -> Pe_hocon_setting <| |>
45
+
46
+ # Create config files that were delete and are now unmanaged
47
+ $new_config_files = [
48
+ "${puppetserver_conf_dir}/metrics.conf",
49
+ "${puppetserver_conf_dir}/webserver.conf",
50
+ "${puppetserver_conf_dir}/global.conf",
51
+ ]
52
+
53
+ file { $new_config_files:
54
+ ensure => file,
55
+ owner => 'root',
56
+ group => 'root',
57
+ mode => '0644',
58
+ require => Package['pe-puppetserver'],
59
+ }
60
+
61
+ # Set the metrics server ID
62
+ pe_hocon_setting { 'metrics.server-id':
63
+ setting => 'metrics.server-id',
64
+ path => "${puppetserver_conf_dir}/metrics.conf",
65
+ value => $facts['hostname'],
66
+ notify => Service['pe-puppetserver'],
67
+ }
68
+
69
+ # Set log config location
70
+ pe_hocon_setting { 'global.logging-config':
71
+ setting => 'global.logging-config',
72
+ path => "${puppetserver_conf_dir}/global.conf",
73
+ value => '/etc/puppetlabs/puppetserver/logback.xml',
74
+ notify => Service['pe-puppetserver'],
75
+ }
76
+
77
+ # Ensure that the /status endpoint exists
78
+ pe_hocon_setting { 'web-router-service.status-service':
79
+ path => "${puppetserver_conf_dir}/web-routes.conf",
80
+ setting => 'web-router-service."puppetlabs.trapperkeeper.services.status.status-service/status-service"',
81
+ value => '/status',
82
+ notify => Service['pe-puppetserver'],
83
+ }
84
+
85
+ # Set the authorization version as this is required
86
+ pe_hocon_setting { 'authorization.version':
87
+ setting => 'authorization.version',
88
+ path => '/etc/puppetlabs/puppetserver/conf.d/auth.conf',
89
+ value => 1,
90
+ notify => Service['pe-puppetserver'],
91
+ }
92
+
93
+ # Set a gem home so that gems can be listed
94
+ pe_hocon_setting { 'jruby-puppet.gem-home':
95
+ setting => 'jruby-puppet.gem-home',
96
+ path => "${puppetserver_conf_dir}/pe-puppet-server.conf",
97
+ value => '/opt/puppetlabs/server/data/puppetserver/jruby-gems',
98
+ notify => Service['pe-puppetserver'],
99
+ }
100
+
101
+ # Removed the versioned code service as this brings in all of the puppetserver dependencies
102
+ Puppet_enterprise::Trapperkeeper::Bootstrap_cfg <| title == 'file-sync-versioned-code-service' |> {
103
+ ensure => 'absent',
104
+ }
105
+
106
+ # Create all services in bootstrap.cfg
107
+ puppet_enterprise::trapperkeeper::bootstrap_cfg { 'jetty9-service':
108
+ namespace => 'puppetlabs.trapperkeeper.services.webserver.jetty9-service',
109
+ }
110
+
111
+ puppet_enterprise::trapperkeeper::bootstrap_cfg { 'webrouting-service':
112
+ namespace => 'puppetlabs.trapperkeeper.services.webrouting.webrouting-service',
113
+ }
114
+
115
+ puppet_enterprise::trapperkeeper::bootstrap_cfg { 'scheduler-service':
116
+ namespace => 'puppetlabs.trapperkeeper.services.scheduler.scheduler-service',
117
+ }
118
+
119
+ puppet_enterprise::trapperkeeper::bootstrap_cfg { 'status-service':
120
+ namespace => 'puppetlabs.trapperkeeper.services.status.status-service',
121
+ }
122
+
123
+ puppet_enterprise::trapperkeeper::bootstrap_cfg { 'authorization-service':
124
+ namespace => 'puppetlabs.trapperkeeper.services.authorization.authorization-service',
125
+ }
126
+
127
+ puppet_enterprise::trapperkeeper::bootstrap_cfg { 'metrics-service':
128
+ namespace => 'puppetlabs.trapperkeeper.services.metrics.metrics-service',
129
+ }
130
+
131
+ # Set up file-sync
132
+ class { 'puppet_enterprise::master::file_sync':
133
+ puppet_master_host => $puppet_enterprise::puppet_master_host,
134
+ master_of_masters_certname => $puppet_enterprise::puppet_master_host,
135
+ localcacert => $puppet_enterprise::params::localcacert,
136
+ puppetserver_jruby_puppet_master_code_dir => $code_dir,
137
+ puppetserver_webserver_ssl_port => '8140',
138
+ storage_service_disabled => true,
139
+ }
140
+
141
+ puppet_enterprise::trapperkeeper::webserver_settings { 'puppet-server':
142
+ container => 'puppetserver',
143
+ ssl_listen_address => '0.0.0.0',
144
+ ssl_listen_port => 8140,
145
+ default_server => true,
146
+ notify => Service['pe-puppetserver'],
147
+ }
148
+
149
+ # Set the Java args
150
+ puppet_enterprise::trapperkeeper::java_args { 'puppetserver':
151
+ java_args => $java_args,
152
+ enable_gc_logging => $enable_gc_logging,
153
+ }
154
+
155
+ # Allow users to access the status endpoint
156
+ pe_puppet_authorization::rule { 'puppetlabs status service':
157
+ path => '/etc/puppetlabs/puppetserver/conf.d/auth.conf',
158
+ match_request_path => '/status/v1/services',
159
+ match_request_type => 'path',
160
+ match_request_method => 'get',
161
+ allow_unauthenticated => true,
162
+ sort_order => 500,
163
+ notify => Service['pe-puppetserver'],
164
+ }
165
+ }
@@ -0,0 +1,37 @@
1
+ # This class patches the Puppet MoMs to allow all nodes that are able to access
2
+ # the file-sync API to also be clients
3
+ class profile::file_sync::master_patch {
4
+ # This repliaces the logic from the puppet_enterprise::master::file_sync
5
+ # class in order add our file_sync server to the list of allowed clients.
6
+ # Note that the server muct be specified using hiera with the
7
+ # puppet_enterprise::master::file_sync::whitelisted_certnames key
8
+ $masters_in_puppetdb = map(
9
+ puppetdb_query(['from', 'resources',
10
+ ['extract', ['certname'],
11
+ ['and', ['=', 'type', 'Class'],
12
+ ['=', 'title', 'Puppet_enterprise::Profile::Master'],
13
+ ['=', ['node','active'], true]]]])) |$master| { $master['certname'] }
14
+ $file_sync_clients_in_puppetdb = map(
15
+ puppetdb_query(['from', 'resources',
16
+ ['extract', ['certname'],
17
+ ['and', ['=', 'type', 'Class'],
18
+ ['=', 'title', 'Profile::File_sync::Client'],
19
+ ['=', ['node','active'], true]]]])) |$master| { $master['certname'] }
20
+ $whitelisted_certnames = lookup('puppet_enterprise::master::file_sync::whitelisted_certnames', {'default_value' => []})
21
+ $list = $whitelisted_certnames + $file_sync_clients_in_puppetdb + $masters_in_puppetdb
22
+ $authorized_certs = pe_union([$facts['certname']], $list)
23
+ $certs_authorized_to_communicate_with_file_sync = pe_sort(delete_undef_values(pe_unique($authorized_certs)))
24
+
25
+
26
+ Pe_hocon_setting <| title == 'file-sync.client-certnames' |> {
27
+ value => $certs_authorized_to_communicate_with_file_sync,
28
+ }
29
+
30
+ Pe_puppet_authorization::Rule <| title == 'puppetlabs file sync api' |> {
31
+ allow => $certs_authorized_to_communicate_with_file_sync,
32
+ }
33
+
34
+ Pe_puppet_authorization::Rule <| title == 'puppetlabs file sync repo' |> {
35
+ allow => $certs_authorized_to_communicate_with_file_sync,
36
+ }
37
+ }
@@ -0,0 +1,17 @@
1
+ define profile::grafana::dashboard (
2
+ $metrics_server_id,
3
+ ) {
4
+ # Swap dots for underscores as grafana deasn't like dots
5
+ $safe_title = regsubst($title,'\.','_','G')
6
+
7
+ file { "/opt/grafana/app/dashboards/${safe_title}.json":
8
+ ensure => file,
9
+ owner => 'root',
10
+ group => 'root',
11
+ mode => '0664',
12
+ content => epp('profile/dashboard.json.epp',{
13
+ 'title' => $title,
14
+ 'metrics_server_id' => $metrics_server_id,
15
+ }),
16
+ }
17
+ }
@@ -0,0 +1,43 @@
1
+ # == Class: profile::haproxy
2
+ #
3
+ # Hosts stats at :9090 puppet:puppet
4
+ #
5
+ # @param listening_pools A hash of listening pools
6
+ class profile::haproxy (
7
+ Hash $listening_pools = {}
8
+ ) {
9
+ include ::haproxy
10
+
11
+ # Disbale firewall for load balancers
12
+ service { 'firewalld':
13
+ ensure => 'stopped',
14
+ enable => false,
15
+ }
16
+
17
+ $listening_pools.each |$name, $params| {
18
+ haproxy::listen { $name:
19
+ ipaddress => '0.0.0.0',
20
+ * => $params,
21
+ }
22
+ }
23
+
24
+ ini_setting { 'runinterval':
25
+ ensure => present,
26
+ path => '/etc/puppetlabs/puppet/puppet.conf',
27
+ section => 'agent',
28
+ setting => 'runinterval',
29
+ value => '60',
30
+ }
31
+
32
+ haproxy::listen { 'stats':
33
+ ipaddress => '0.0.0.0',
34
+ ports => '9090',
35
+ options => {
36
+ 'mode' => 'http',
37
+ 'stats' => [
38
+ 'uri /',
39
+ 'auth puppet:puppet',
40
+ ],
41
+ },
42
+ }
43
+ }
@@ -0,0 +1,3 @@
1
+ class profile {
2
+ # Never actually use this class, this is just a placeholder for the time being
3
+ }
@@ -0,0 +1,87 @@
1
+ # Plugins with the correct version
2
+ class profile::jenkins::plugins {
3
+ $plugins = {
4
+ 'pipeline-milestone-step' => '1.3.1',
5
+ 'pipeline-rest-api' => '2.8',
6
+ 'handlebars' => '1.1.1',
7
+ 'momentjs' => '1.1.1',
8
+ 'pipeline-stage-view' => '2.8',
9
+ 'pipeline-build-step' => '2.5.1',
10
+ 'workflow-aggregator' => '2.5',
11
+ 'pipeline-model-api' => '1.1.8',
12
+ 'bouncycastle-api' => '2.16.1',
13
+ 'favorite' => '2.3.0',
14
+ 'jackson2-api' => '2.7.3',
15
+ 'github-api' => '1.86',
16
+ 'workflow-step-api' => '2.12',
17
+ 'workflow-scm-step' => '2.6',
18
+ 'pubsub-light' => '1.11',
19
+ 'docker-workflow' => '1.12',
20
+ 'ssh-credentials' => '1.13',
21
+ 'blueocean-config' => '1.1.4',
22
+ 'git-client' => '2.4.6',
23
+ 'scm-api' => '2.1.1',
24
+ 'display-url-api' => '2.0',
25
+ 'mailer' => '1.20',
26
+ 'junit' => '1.20',
27
+ 'script-security' => '1.29.1',
28
+ 'workflow-basic-steps' => '2.6',
29
+ 'matrix-project' => '1.11',
30
+ 'git' => '3.3.2',
31
+ 'token-macro' => '2.1',
32
+ 'pipeline-model-definition' => '1.1.8',
33
+ 'plain-credentials' => '1.4',
34
+ 'sse-gateway' => '1.15',
35
+ 'github' => '1.27.0',
36
+ 'github-branch-source' => '2.0.8',
37
+ 'blueocean-events' => '1.1.4',
38
+ 'ace-editor' => '1.1',
39
+ 'jquery-detached' => '1.2.1',
40
+ 'blueocean-i18n' => '1.1.4',
41
+ 'workflow-api' => '2.18',
42
+ 'variant' => '1.1',
43
+ 'workflow-support' => '2.14',
44
+ 'workflow-cps' => '2.36.1',
45
+ 'pipeline-input-step' => '2.7',
46
+ 'metrics' => '3.1.2.10',
47
+ 'pipeline-stage-step' => '2.2',
48
+ 'workflow-job' => '2.12.1',
49
+ 'credentials-binding' => '1.12',
50
+ 'pipeline-graph-analysis' => '1.4',
51
+ 'blueocean-commons' => '1.1.4',
52
+ 'blueocean-web' => '1.1.4',
53
+ 'blueocean-rest' => '1.1.4',
54
+ 'cloudbees-folder' => '6.0.4',
55
+ 'branch-api' => '2.0.10',
56
+ 'blueocean-jwt' => '1.1.4',
57
+ 'workflow-multibranch' => '2.16',
58
+ 'blueocean-pipeline-scm-api' => '1.1.4',
59
+ 'docker-commons' => '1.8',
60
+ 'pipeline-model-extensions' => '1.1.8',
61
+ 'git-server' => '1.7',
62
+ 'durable-task' => '1.14',
63
+ 'workflow-cps-global-lib' => '2.8',
64
+ 'blueocean' => '1.1.4',
65
+ 'icon-shim' => '2.0.3',
66
+ 'authentication-tokens' => '1.3',
67
+ 'workflow-durable-task-step' => '2.12',
68
+ 'pipeline-stage-tags-metadata' => '1.1.8',
69
+ 'pipeline-model-declarative-agent' => '1.1.1',
70
+ 'blueocean-rest-impl' => '1.1.4',
71
+ 'blueocean-pipeline-api-impl' => '1.1.4',
72
+ 'blueocean-github-pipeline' => '1.1.4',
73
+ 'blueocean-git-pipeline' => '1.1.4',
74
+ 'blueocean-personalization' => '1.1.4',
75
+ 'blueocean-display-url' => '2.0',
76
+ 'blueocean-pipeline-editor' => '0.2.0',
77
+ 'blueocean-autofavorite' => '1.0.0',
78
+ 'blueocean-dashboard' => '1.1.4',
79
+ 'puppet-enterprise-pipeline' => '1.3.1',
80
+ }
81
+
82
+ $plugins.each |$name,$version| {
83
+ jenkins::plugin { $name:
84
+ version => $version,
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,65 @@
1
+ class profile::jenkins {
2
+ class { '::jenkins':
3
+ version => '2.60.1',
4
+ service_enable => false,
5
+ configure_firewall => true,
6
+ executors => $::processors['count'],
7
+ }
8
+
9
+ include ::profile::jenkins::plugins
10
+
11
+ jenkins::job { 'Onceover':
12
+ config => epp('profile/onceover_jenkins_job.xml'),
13
+ require => Package['jenkins'],
14
+ }
15
+
16
+ jenkins::job { 'Controlrepo Test and Deploy':
17
+ config => epp('profile/controlrepo_deploy_jenkins_job.xml'),
18
+ require => Package['jenkins'],
19
+ }
20
+
21
+ include ::profile::base
22
+
23
+ include ::profile::nginx
24
+
25
+ # Include a reverse proxy in front
26
+ nginx::resource::server { $::hostname:
27
+ listen_port => 80,
28
+ listen_options => 'default_server',
29
+ proxy => 'http://localhost:8080',
30
+ }
31
+
32
+ # Set Jenkins' default shell to bash
33
+ file { 'jenkins_default_shell':
34
+ ensure => file,
35
+ path => '/var/lib/jenkins/hudson.tasks.Shell.xml',
36
+ source => 'puppet:///modules/profile/hudson.tasks.Shell.xml',
37
+ notify => Service['jenkins'],
38
+ require => Package['jenkins'],
39
+ }
40
+
41
+ # Create a user in the Puppet console for Jenkins
42
+ @@console::user { 'jenkins':
43
+ password => fqdn_rand_string(20, '', 'jenkins'),
44
+ display_name => 'Jenkins',
45
+ roles => ['Developers'],
46
+ }
47
+
48
+ # Create the details for the Puppet token
49
+ $token = console::user::token('jenkins')
50
+ $secret_json = epp('profile/jenkins_secret_text.json.epp',{
51
+ 'id' => 'PE-Deploy-Token',
52
+ 'description' => 'Puppet Enterprise Token',
53
+ 'secret' => $token,
54
+ })
55
+ $secret_json_escaped = shell_escape($secret_json)
56
+
57
+ # If the token has been generated then create it
58
+ # if $token {
59
+ # jenkins_credentials { 'PE-Deploy-Token':
60
+ # impl => 'StringCredentialsImpl',
61
+ # secret => $token,
62
+ # description => 'Puppet Enterprise Token',
63
+ # }
64
+ # }
65
+ }
@@ -0,0 +1,39 @@
1
+ # Installs jira and postgres and the JRE
2
+ class profile::jira::aio {
3
+ file { '/opt/jira':
4
+ ensure => 'directory',
5
+ before => Class['jira'],
6
+ }
7
+
8
+ class { 'postgresql::globals':
9
+ manage_package_repo => true,
10
+ version => '9.3',
11
+ }
12
+
13
+ class { 'postgresql::server':
14
+ require => Class['postgresql::globals']
15
+ }
16
+
17
+ class { 'java':
18
+ distribution => 'jre',
19
+ }
20
+
21
+ service { 'iptables':
22
+ ensure => 'stopped',
23
+ }
24
+
25
+ class { 'jira':
26
+ javahome => '/usr',
27
+ db => 'postgresql',
28
+ dbuser => 'jiraadm',
29
+ dbserver => 'localhost',
30
+ require => [Class['java'],Postgresql::Server::Db['jira']],
31
+ }
32
+
33
+ postgresql::server::db { 'jira':
34
+ user => 'jiraadm',
35
+ password => postgresql_password('jiraadm', 'mypassword'),
36
+ require => Class['postgresql::server'],
37
+ }
38
+
39
+ }
@@ -0,0 +1,27 @@
1
+ class profile::jira::app {
2
+ $db_server = hiera('profile::jira::db_server')
3
+ $db_user = hiera('profile::jira::db_user')
4
+ $db_password = hiera('profile::jira::db_password')
5
+
6
+ file { '/opt/jira':
7
+ ensure => 'directory',
8
+ before => Class['jira'],
9
+ }
10
+
11
+ class { 'java':
12
+ distribution => 'jre',
13
+ }
14
+
15
+ service { 'iptables':
16
+ ensure => 'stopped',
17
+ }
18
+
19
+ class { 'jira':
20
+ javahome => '/usr',
21
+ db => 'postgresql',
22
+ dbuser => $db_user,
23
+ dbserver => $db_server,
24
+ dbpassword => $db_password,
25
+ require => Class['java'],
26
+ }
27
+ }
@@ -0,0 +1,25 @@
1
+ class profile::jira::db {
2
+ $db_user = hiera('profile::jira::db_user')
3
+ $db_password = hiera('profile::jira::db_password')
4
+
5
+ class { 'postgresql::globals':
6
+ manage_package_repo => true,
7
+ version => '9.3',
8
+ }
9
+
10
+ class { 'postgresql::server':
11
+ listen_addresses => '*',
12
+ ip_mask_allow_all_users => '0.0.0.0/0',
13
+ require => Class['postgresql::globals']
14
+ }
15
+
16
+ service { 'iptables':
17
+ ensure => 'stopped',
18
+ }
19
+
20
+ postgresql::server::db { 'jira':
21
+ user => $db_user,
22
+ password => postgresql_password($db_user, $db_password),
23
+ require => Class['postgresql::server'],
24
+ }
25
+ }
@@ -0,0 +1,82 @@
1
+ class profile::metrics::collectd::compile {
2
+ # This class is for compiling collectd from source, but is redundant
3
+ # if you can get at the package
4
+
5
+ $collectd_version = '5.5.0'
6
+ $collectd_dir = '/etc/collectd'
7
+
8
+ $dependencies = [
9
+ 'libatasmart-devel',
10
+ 'libcurl-devel',
11
+ 'libdbi-devel',
12
+ 'libesmtp-devel',
13
+ 'ganglia-devel',
14
+ 'libgcrypt-devel',
15
+ 'hal-devel',
16
+ 'hiredis-devel',
17
+ 'iptables-devel',
18
+ 'java-1.8.0-openjdk-devel',
19
+ 'openldap-devel',
20
+ 'lvm2-devel',
21
+ 'libmemcached-devel',
22
+ 'libmnl-devel',
23
+ 'libmodbus-devel',
24
+ 'mysql-devel',
25
+ 'net-snmp-devel',
26
+ 'libnotify-devel',
27
+ 'OpenIPMI-devel',
28
+ 'liboping-devel',
29
+ 'libpcap-devel',
30
+ 'perl-devel',
31
+ 'perl-ExtUtils-Embed',
32
+ 'postgresql-devel',
33
+ 'librabbitmq-devel',
34
+ 'rrdtool-devel',
35
+ 'lm_sensors-devel',
36
+ 'libstatgrab-devel',
37
+ 'libudev-devel',
38
+ 'nut-devel',
39
+ 'varnish-libs-devel',
40
+ 'libvirt-devel',
41
+ 'libxml2-devel',
42
+ 'yajl-devel',
43
+ 'protobuf-c-devel',
44
+ 'python-devel',
45
+ 'libtool-ltdl-devel',
46
+ ]
47
+
48
+ require ::gcc
49
+
50
+ package { $dependencies:
51
+ ensure => present,
52
+ }
53
+
54
+ file { $collectd_dir:
55
+ ensure => directory,
56
+ owner => 'root',
57
+ group => 'root',
58
+ mode => '0644',
59
+ }
60
+
61
+ staging::deploy { "collectd-${collectd_version}.tar.bz2":
62
+ target => $collectd_dir,
63
+ source => "http://collectd.org/files/collectd-${collectd_version}.tar.bz2",
64
+ require => File[$collectd_dir],
65
+ }
66
+
67
+ exec { 'configure_collectd':
68
+ command => 'configure',
69
+ cwd => "${collectd_dir}/collectd-${collectd_version}",
70
+ path => "${::path}:${collectd_dir}/collectd-${collectd_version}",
71
+ creates => "${collectd_dir}/collectd-${collectd_version}/config.status",
72
+ require => Staging::Deploy["collectd-${collectd_version}.tar.bz2"],
73
+ }
74
+
75
+ exec { 'install_collectd':
76
+ command => 'make all install',
77
+ path => "${::path}:${collectd_dir}/collectd-${collectd_version}",
78
+ creates => '/opt/collectd',
79
+ require => [Exec['configure_collectd'],Package[$dependencies]],
80
+ }
81
+
82
+ }
@@ -0,0 +1,28 @@
1
+ class profile::metrics::collectd {
2
+
3
+ class { '::collectd':
4
+ purge_config => true,
5
+ interval => 5,
6
+ }
7
+
8
+ include ::collectd::plugin::cpu
9
+ #include ::collectd::plugin::disk
10
+ include ::collectd::plugin::memory
11
+ include ::collectd::plugin::interface
12
+ include ::collectd::plugin::df
13
+
14
+ $monitoring_node = lookup({
15
+ 'name' => 'puppet_enterprise::profile::master::metrics_graphite_host',
16
+ 'default_value' => false,
17
+ })
18
+
19
+ if $monitoring_node {
20
+ collectd::plugin::write_graphite::carbon {'my_graphite':
21
+ graphitehost => $monitoring_node,
22
+ graphiteport => 2003,
23
+ graphiteprefix => '',
24
+ protocol => 'tcp',
25
+ }
26
+ }
27
+
28
+ }
@@ -0,0 +1,28 @@
1
+ # Creates the metrics dashboard
2
+ class profile::metrics::dashboard (
3
+ Array $master_list = [$server_facts['servername']],
4
+ ) {
5
+ class { 'puppet_metrics_dashboard':
6
+ add_dashboard_examples => true,
7
+ consume_graphite => true,
8
+ influxdb_database_name => ["graphite"],
9
+ master_list => $master_list,
10
+ overwrite_dashboards => false,
11
+ }
12
+
13
+ include nginx
14
+
15
+ nginx::resource::server { $facts['fqdn']:
16
+ listen_port => 80,
17
+ ssl => true,
18
+ ssl_cert => "/etc/puppetlabs/puppet/ssl/certs/${facts['fqdn']}.pem",
19
+ ssl_key => "/etc/puppetlabs/puppet/ssl/private_keys/${facts['fqdn']}.pem",
20
+ proxy => 'http://localhost:3000',
21
+ }
22
+
23
+ # Remove the default config file
24
+ file { '/etc/nginx/conf.d/default.conf':
25
+ ensure => absent,
26
+ notify => Service['nginx'],
27
+ }
28
+ }
@@ -0,0 +1,7 @@
1
+ class profile::mysql_server {
2
+ include mysql::server
3
+
4
+ unless $::kernel == 'linux' {
5
+ fail('The profile::mysql_server profile cannot be used on non-linux systems')
6
+ }
7
+ }