onceover 3.21.0 → 3.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/devcontainer.json +4 -6
- data/.github/workflows/release.yaml +24 -0
- data/Gemfile +3 -0
- data/README.md +45 -1
- data/Rakefile +1 -0
- data/cucumber.yml +1 -0
- data/features/step_definitions/run.rb +4 -0
- data/features/zzz_run.feature +1 -8
- data/lib/onceover/beaker/spec_helper.rb +8 -8
- data/lib/onceover/controlrepo.rb +3 -3
- data/lib/onceover/deploy.rb +1 -1
- data/lib/onceover/rspec/formatters.rb +2 -4
- data/lib/onceover/runner.rb +1 -1
- data/lib/onceover/test.rb +1 -1
- data/onceover.gemspec +6 -13
- data/spec/fixtures/controlrepos/puppet_controlrepo/.atom-build.json +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.gitignore +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.ruby-version +1 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.travis.yml +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Gemfile +22 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Jenkinsfile +50 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Puppetfile +102 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/README.md +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Rakefile +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/common.yaml +558 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/melbourne.yaml +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/singapore.yaml +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/development.yaml +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/production.yaml +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/size/vol.large.yaml +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/environment.conf +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/hiera.yaml +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/manifests/site.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/code_manager_config_version.rb +19 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.rb +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.sh +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/count_changed_classes.rb +26 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/get_changed_classes.rb +26 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/functions/user/token.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/init.pp +14 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/user.pp +35 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/lib/puppet/functions/deployments/generate.rb +15 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/plans/signed_deployment.pp +126 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/facts.d/test.sh +2 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/artifactory/config_descriptor.xml +265 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/autosign.sh +23 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/hudson.tasks.Shell.xml +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/motd +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/polar_clock/index.html +198 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/apt.pp +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/aws_nodes.pp +54 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/aws.pp +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/rhel.pp +50 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows/hardening.pp +57 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows.pp +52 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base.pp +79 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/artifactory.pp +64 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/connection.pp +95 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/haproxy.pp +65 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/replicated.pp +53 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/balancer.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/master.pp +19 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/host_record.pp +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/server.pp +66 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/docker.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/base.pp +43 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core/database_connection.pp +42 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core.pp +72 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/ctrl.pp +57 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/database.pp +32 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/exec.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/client.pp +165 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/master_patch.pp +37 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/grafana/dashboard.pp +17 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/haproxy.pp +43 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/init.pp +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins/plugins.pp +87 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins.pp +65 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/aio.pp +39 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/app.pp +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/db.pp +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd/compile.pp +82 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/dashboard.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/mysql_server.pp +7 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/nginx.pp +24 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/polar_clock.pp +55 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/api_auth.pp +82 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/autosign.pp +33 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/aws.pp +58 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/tuning.pp +139 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster.pp +139 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/rvm.pp +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sumologic.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sunburst/windows.pp +104 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/vagrant.pp +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/windows/webserver.pp +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/cd4pe/connection_script.sh.epp +110 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/controlrepo_deploy_jenkins_job.xml.epp +51 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/dashboard.json.epp +403 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/jenkins_secret_text.json.epp +1 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/onceover_jenkins_job.xml.epp +51 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/userdata.epp +17 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/cd4pe.pp +29 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/clock.pp +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/balancer.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/master.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/aio.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/controller.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/database.pp +7 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/exec.pp +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/init.pp +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/lb.pp +14 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/metrics.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/mysql.pp +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/base.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/webserver.pp +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/.gitignore +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/acceptance/nodesets/onceover-nodes.yml +94 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/classes/test_spec.rb +8 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master-2017.3.2.json +531 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master.json +429 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64.json +353 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2008r2-64.json +184 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2012r2-64.json +165 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/hiera.yaml +18 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/matchers/file_matchers.rb +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/onceover.yaml +54 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/pre_conditions/site.pp +150 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/r10k.yaml +2 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/shared_examples/helper.rb +91 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/00_parse_spec.rb +76 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/01_linting_spec_example.rb +69 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/03_puppetfile_spec_example.rb +35 -0
- data/templates/spec_helper.rb.erb +0 -2
- data/templates/test_spec.rb.erb +3 -0
- metadata +137 -79
- data/.gitmodules +0 -4
@@ -0,0 +1,24 @@
|
|
1
|
+
# # Generic Nginx profile
|
2
|
+
#
|
3
|
+
# Installs nginx base as per the module. To use nging in other profiles just do
|
4
|
+
# the following:
|
5
|
+
#
|
6
|
+
# ```puppet
|
7
|
+
# include profile::nginx
|
8
|
+
#
|
9
|
+
# nginx::resource::server { 'my-server.com':
|
10
|
+
# listen_port => 80,
|
11
|
+
# www_root => '/var/www',
|
12
|
+
# }
|
13
|
+
# ```
|
14
|
+
#
|
15
|
+
class profile::nginx {
|
16
|
+
include ::nginx
|
17
|
+
|
18
|
+
file { 'default_config_file':
|
19
|
+
ensure => absent,
|
20
|
+
path => "${nginx::conf_dir}/conf.d/default.conf",
|
21
|
+
require => Class['nginx::config'],
|
22
|
+
notify => Class['nginx::service'],
|
23
|
+
}
|
24
|
+
}
|
data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/polar_clock.pp
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# # Polar Clock
|
2
|
+
#
|
3
|
+
# Serves a polar clock webpage using nginx.
|
4
|
+
#
|
5
|
+
# This also exports a resource for the polar_clock listening service in haproxy
|
6
|
+
#
|
7
|
+
# @param install_dir Where to install the website
|
8
|
+
# @param port Which port to run on
|
9
|
+
class profile::polar_clock (
|
10
|
+
Stdlib::Absolutepath $install_dir = '/var/clock',
|
11
|
+
Integer $port = 8080,
|
12
|
+
) {
|
13
|
+
file { $install_dir:
|
14
|
+
ensure => directory,
|
15
|
+
owner => 'root',
|
16
|
+
group => 'root',
|
17
|
+
mode => '0755',
|
18
|
+
}
|
19
|
+
|
20
|
+
file { "${install_dir}/index.html":
|
21
|
+
ensure => file,
|
22
|
+
owner => 'root',
|
23
|
+
group => 'root',
|
24
|
+
mode => '0644',
|
25
|
+
source => 'puppet:///modules/profile/polar_clock/index.html',
|
26
|
+
}
|
27
|
+
|
28
|
+
include profile::nginx
|
29
|
+
|
30
|
+
nginx::resource::server { $::fqdn:
|
31
|
+
listen_port => $port,
|
32
|
+
www_root => $install_dir,
|
33
|
+
}
|
34
|
+
|
35
|
+
firewall { '100 allow http':
|
36
|
+
dport => $port,
|
37
|
+
proto => tcp,
|
38
|
+
action => accept,
|
39
|
+
}
|
40
|
+
|
41
|
+
# Detect the correct IP based on what virualisation we are using
|
42
|
+
$ip = $facts['virtual'] ? {
|
43
|
+
'virtualbox' => $facts['networking']['interfaces']['enp0s8']['ip'],
|
44
|
+
default => $facts['networking']['ip'],
|
45
|
+
}
|
46
|
+
|
47
|
+
# Export balancer member in case this load balanced
|
48
|
+
@@haproxy::balancermember { "${facts['fqdn']}-polar_clock":
|
49
|
+
listening_service => 'polar_clock',
|
50
|
+
ports => $port,
|
51
|
+
server_names => $facts['fqdn'],
|
52
|
+
ipaddresses => $ip,
|
53
|
+
options => 'check',
|
54
|
+
}
|
55
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#
|
2
|
+
class profile::puppetmaster::api_auth {
|
3
|
+
hocon_setting { 'allow unauthenticated environment_classes':
|
4
|
+
ensure => present,
|
5
|
+
path => '/etc/puppetlabs/puppetserver/conf.d/auth.conf',
|
6
|
+
setting => 'authorization.rules',
|
7
|
+
type => 'array_element',
|
8
|
+
value => {
|
9
|
+
'allow-unauthenticated' => true,
|
10
|
+
'match-request' => {
|
11
|
+
'method' => 'get',
|
12
|
+
'path' => '/puppet/v3/environment_classes',
|
13
|
+
'query-params' => {},
|
14
|
+
'type' => 'path'
|
15
|
+
},
|
16
|
+
'name' => 'puppetlabs environment classes allow all',
|
17
|
+
'sort-order' => 490
|
18
|
+
},
|
19
|
+
notify => Service['pe-puppetserver'],
|
20
|
+
}
|
21
|
+
|
22
|
+
hocon_setting { 'allow unauthenticated environment-cache':
|
23
|
+
ensure => present,
|
24
|
+
path => '/etc/puppetlabs/puppetserver/conf.d/auth.conf',
|
25
|
+
setting => 'authorization.rules',
|
26
|
+
type => 'array_element',
|
27
|
+
value => {
|
28
|
+
'allow-unauthenticated' => true,
|
29
|
+
'match-request' => {
|
30
|
+
'method' => 'delete',
|
31
|
+
'path' => '/puppet-admin-api/v1/environment-cache',
|
32
|
+
'query-params' => {},
|
33
|
+
'type' => 'path'
|
34
|
+
},
|
35
|
+
'name' => 'puppetlabs environment cache allow all',
|
36
|
+
'sort-order' => 490
|
37
|
+
},
|
38
|
+
notify => Service['pe-puppetserver'],
|
39
|
+
}
|
40
|
+
|
41
|
+
hocon_setting { 'allow unauthenticated jruby-pool':
|
42
|
+
ensure => present,
|
43
|
+
path => '/etc/puppetlabs/puppetserver/conf.d/auth.conf',
|
44
|
+
setting => 'authorization.rules',
|
45
|
+
type => 'array_element',
|
46
|
+
value => {
|
47
|
+
'allow-unauthenticated' => true,
|
48
|
+
'match-request' => {
|
49
|
+
'method' => 'delete',
|
50
|
+
'path' => '/puppet-admin-api/v1/jruby-pool',
|
51
|
+
'query-params' => {},
|
52
|
+
'type' => 'path'
|
53
|
+
},
|
54
|
+
'name' => 'puppetlabs jruby pool allow all',
|
55
|
+
'sort-order' => 490
|
56
|
+
},
|
57
|
+
notify => Service['pe-puppetserver'],
|
58
|
+
}
|
59
|
+
|
60
|
+
hocon_setting { 'allow unauthenticated certificate_status':
|
61
|
+
ensure => present,
|
62
|
+
path => '/etc/puppetlabs/puppetserver/conf.d/auth.conf',
|
63
|
+
setting => 'authorization.rules',
|
64
|
+
type => 'array_element',
|
65
|
+
value => {
|
66
|
+
'allow-unauthenticated' => true,
|
67
|
+
'match-request' => {
|
68
|
+
'method' => [
|
69
|
+
'get',
|
70
|
+
'put',
|
71
|
+
'delete'
|
72
|
+
],
|
73
|
+
'path' => '/puppet-ca/v1/certificate_status',
|
74
|
+
'query-params' => {},
|
75
|
+
'type' => 'path'
|
76
|
+
},
|
77
|
+
'name' => 'puppetlabs certificate status allow all',
|
78
|
+
'sort-order' => 490
|
79
|
+
},
|
80
|
+
notify => Service['pe-puppetserver'],
|
81
|
+
}
|
82
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class profile::puppetmaster::autosign (
|
2
|
+
String $logfile = '/var/log/puppetlabs/puppetserver/autosign.log',
|
3
|
+
String $journalfile = '/etc/puppetlabs/puppetserver/autosign.journal',
|
4
|
+
String $confdir = '/etc/puppetlabs/puppet',
|
5
|
+
String $password = undef,
|
6
|
+
) {
|
7
|
+
class { '::autosign':
|
8
|
+
ensure => 'latest',
|
9
|
+
settings => {
|
10
|
+
'general' => {
|
11
|
+
'loglevel' => 'INFO',
|
12
|
+
'logfile' => $logfile,
|
13
|
+
},
|
14
|
+
'jwt_token' => {
|
15
|
+
'secret' => fqdn_rand_string(10),
|
16
|
+
'validity' => '7200',
|
17
|
+
'journalfile' => $journalfile,
|
18
|
+
},
|
19
|
+
'password_list' => {
|
20
|
+
'password' => $password,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
}
|
24
|
+
|
25
|
+
ini_setting {'policy-based autosigning':
|
26
|
+
setting => 'autosign',
|
27
|
+
path => "${confdir}/puppet.conf",
|
28
|
+
section => 'master',
|
29
|
+
value => '/opt/puppetlabs/puppet/bin/autosign-validator',
|
30
|
+
notify => Service['pe-puppetserver'],
|
31
|
+
require => Class['::autosign'],
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class profile::puppetmaster::aws (
|
2
|
+
String $confdir = '/etc/puppetlabs/puppet',
|
3
|
+
) {
|
4
|
+
package { 'aws-sdk-core':
|
5
|
+
ensure => present,
|
6
|
+
provider => 'puppetserver_gem',
|
7
|
+
notify => Service['pe-puppetserver'],
|
8
|
+
}
|
9
|
+
|
10
|
+
if puppetdb_query('resources { type = "Class" and title = "autosign" }').count > 0 {
|
11
|
+
include profile::aws_nodes
|
12
|
+
}
|
13
|
+
|
14
|
+
# Set up the default config for the AWS module
|
15
|
+
# I will also need to do the following on the Puppet Master:
|
16
|
+
#
|
17
|
+
# export AWS_ACCESS_KEY_ID=your_access_key_id
|
18
|
+
# export AWS_SECRET_ACCESS_KEY=your_secret_access_key
|
19
|
+
|
20
|
+
ini_setting { 'aws region':
|
21
|
+
ensure => present,
|
22
|
+
path => "${confdir}/puppetlabs_aws_configuration.ini",
|
23
|
+
section => 'default',
|
24
|
+
setting => 'region',
|
25
|
+
value => 'ap-southeast-2',
|
26
|
+
}
|
27
|
+
|
28
|
+
file { '/root/.aws':
|
29
|
+
ensure => directory,
|
30
|
+
owner => 'root',
|
31
|
+
group => 'root',
|
32
|
+
mode => '0700',
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
# Add policy based autosigning using https://forge.puppet.com/danieldreier/autosign
|
37
|
+
class { 'autosign':
|
38
|
+
user => 'pe-puppet',
|
39
|
+
group => 'pe-puppet',
|
40
|
+
settings => {
|
41
|
+
'general' => {
|
42
|
+
'loglevel' => 'DEBUG',
|
43
|
+
},
|
44
|
+
'jwt_token' => {
|
45
|
+
'secret' => 'DkCieMT9UyMvg(JDQeuJm%Qao>.p*GLxYg}kaw%ExAfRDvh7Mz'
|
46
|
+
},
|
47
|
+
},
|
48
|
+
}
|
49
|
+
|
50
|
+
ini_setting {'policy-based autosigning':
|
51
|
+
setting => 'autosign',
|
52
|
+
path => "${confdir}/puppet.conf",
|
53
|
+
section => 'master',
|
54
|
+
value => '/opt/puppetlabs/puppet/bin/autosign-validator',
|
55
|
+
require => Class['autosign'],
|
56
|
+
notify => Service['pe-puppetserver'],
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# == Class: profile::puppetmaster::tuning
|
2
|
+
#
|
3
|
+
class profile::puppetmaster::tuning {
|
4
|
+
# Take the total system memory
|
5
|
+
$memory_mb = (($::memory['system']['total_bytes'] / 1024) / 1024)
|
6
|
+
|
7
|
+
# How much memory to leave for the system
|
8
|
+
$reserved_memory = $memory_mb / 8
|
9
|
+
|
10
|
+
# Subtract some memory to leave for the system
|
11
|
+
$available_memory = $memory_mb - $reserved_memory
|
12
|
+
|
13
|
+
# Calculate the subsystem memory split
|
14
|
+
$console_services_memory_proportion = 0.2
|
15
|
+
$orchestration_services_memory_proportion = 0.2
|
16
|
+
$puppetdb_memory_proportion = 0.2
|
17
|
+
$activemq_memory_proportion = 0.4
|
18
|
+
|
19
|
+
# How much total memory should be allocated to the subsystems
|
20
|
+
$subsystem_base_memory = 1280
|
21
|
+
|
22
|
+
# Calculate how much the puppetserver and jrubies are going to need
|
23
|
+
$max_active_instances = $::processors['count']
|
24
|
+
$puppetserver_optimal_memory = (512 + ($max_active_instances * 512))
|
25
|
+
|
26
|
+
# Calculate how much memory we have to play with given:
|
27
|
+
# - Puppetserver has optimal memory
|
28
|
+
# - Everything else has base
|
29
|
+
$unallocated_memory_base = ($memory_mb - $reserved_memory
|
30
|
+
- $puppetserver_optimal_memory
|
31
|
+
- $subsystem_base_memory)
|
32
|
+
|
33
|
+
# Double the subsystem memory if possible
|
34
|
+
if ($unallocated_memory_base > $subsystem_base_memory) {
|
35
|
+
$subsystem_memory = $subsystem_base_memory * 2
|
36
|
+
} else {
|
37
|
+
$subsystem_memory = $subsystem_base_memory
|
38
|
+
}
|
39
|
+
|
40
|
+
# Finally: Set up all the variables
|
41
|
+
$console_services_memory = Integer($subsystem_memory * $console_services_memory_proportion)
|
42
|
+
$orchestration_services_memory = Integer($subsystem_memory * $orchestration_services_memory_proportion)
|
43
|
+
$puppetdb_memory = Integer($subsystem_memory * $puppetdb_memory_proportion)
|
44
|
+
$activemq_memory = Integer($subsystem_memory * $activemq_memory_proportion)
|
45
|
+
$puppetserver_memory = Integer($puppetserver_optimal_memory)
|
46
|
+
|
47
|
+
# TODO: Deal with overallocation
|
48
|
+
|
49
|
+
# Final config steps
|
50
|
+
$pe_master_group = node_groups('PE Master')
|
51
|
+
$pe_console_group = node_groups('PE Console')
|
52
|
+
$pe_orchestrator_group = node_groups('PE Orchestrator')
|
53
|
+
$pe_puppetdb_group = node_groups('PE PuppetDB')
|
54
|
+
$pe_activemq_group = node_groups('PE ActiveMQ Broker')
|
55
|
+
|
56
|
+
$pe_master_group_additions = {
|
57
|
+
'puppet_enterprise::profile::master' => {
|
58
|
+
'java_args' => {
|
59
|
+
'Xmx' => "${puppetserver_memory}m",
|
60
|
+
'Xms' => "${puppetserver_memory}m"
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
$pe_console_group_additions = {
|
66
|
+
'puppet_enterprise::profile::console' => {
|
67
|
+
'java_args' => {
|
68
|
+
'Xmx' => "${console_services_memory}m",
|
69
|
+
'Xms' => "${console_services_memory}m"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
$pe_orchestrator_group_additions = {
|
75
|
+
'puppet_enterprise::profile::orchestrator' => {
|
76
|
+
'java_args' => {
|
77
|
+
'Xmx' => "${orchestration_services_memory}m",
|
78
|
+
'Xms' => "${orchestration_services_memory}m"
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
$pe_puppetdb_group_additions = {
|
84
|
+
'puppet_enterprise::profile::puppetdb' => {
|
85
|
+
'java_args' => {
|
86
|
+
'Xmx' => "${puppetdb_memory}m",
|
87
|
+
'Xms' => "${puppetdb_memory}m"
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
# lint:ignore:only_variable_string
|
93
|
+
$pe_activemq_group_additions = {
|
94
|
+
'puppet_enterprise::profile::amq::broker' => {
|
95
|
+
'heap_mb' => "${activemq_memory}"
|
96
|
+
}
|
97
|
+
}
|
98
|
+
# lint:endignore
|
99
|
+
|
100
|
+
node_group { 'PE Master':
|
101
|
+
ensure => present,
|
102
|
+
classes => deep_merge($pe_master_group['PE Master']['classes'],$pe_master_group_additions),
|
103
|
+
parent => 'PE Infrastructure',
|
104
|
+
require => Package['puppetclassify_server'],
|
105
|
+
}
|
106
|
+
|
107
|
+
node_group { 'PE Console':
|
108
|
+
ensure => present,
|
109
|
+
classes => deep_merge($pe_console_group['PE Console']['classes'],$pe_console_group_additions),
|
110
|
+
parent => 'PE Infrastructure',
|
111
|
+
require => Package['puppetclassify_server'],
|
112
|
+
}
|
113
|
+
|
114
|
+
node_group { 'PE Orchestrator':
|
115
|
+
ensure => present,
|
116
|
+
classes => deep_merge($pe_orchestrator_group['PE Orchestrator']['classes'],$pe_orchestrator_group_additions),
|
117
|
+
parent => 'PE Infrastructure',
|
118
|
+
require => Package['puppetclassify_server'],
|
119
|
+
}
|
120
|
+
|
121
|
+
node_group { 'PE PuppetDB':
|
122
|
+
ensure => present,
|
123
|
+
classes => deep_merge($pe_puppetdb_group['PE PuppetDB']['classes'],$pe_puppetdb_group_additions),
|
124
|
+
parent => 'PE Infrastructure',
|
125
|
+
require => Package['puppetclassify_server'],
|
126
|
+
}
|
127
|
+
|
128
|
+
node_group { 'PE ActiveMQ Broker':
|
129
|
+
ensure => present,
|
130
|
+
classes => deep_merge($pe_activemq_group['PE ActiveMQ Broker']['classes'],$pe_activemq_group_additions),
|
131
|
+
parent => 'PE Infrastructure',
|
132
|
+
require => Package['puppetclassify_server'],
|
133
|
+
}
|
134
|
+
|
135
|
+
Pe_hocon_setting <| title == 'jruby-puppet.max-active-instances' |> {
|
136
|
+
ensure => present,
|
137
|
+
value => $max_active_instances,
|
138
|
+
}
|
139
|
+
}
|
data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster.pp
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
# Deals with the Puppet Master
|
2
|
+
class profile::puppetmaster {
|
3
|
+
include pe_databases
|
4
|
+
# Wait until we have installed the stuff first before including this class
|
5
|
+
# if puppetdb_query('resources { type = "Package" and title = "puppetclassify_agent" }').count > 0 {
|
6
|
+
# include profile::puppetmaster::tuning
|
7
|
+
# }
|
8
|
+
|
9
|
+
$server_gems = [
|
10
|
+
'puppetclassify',
|
11
|
+
'retries',
|
12
|
+
]
|
13
|
+
|
14
|
+
# Create basic firewall rules
|
15
|
+
firewall { '100 allow https access':
|
16
|
+
dport => 443,
|
17
|
+
proto => tcp,
|
18
|
+
action => accept,
|
19
|
+
}
|
20
|
+
|
21
|
+
firewall { '101 allow mco access':
|
22
|
+
dport => 61613,
|
23
|
+
proto => tcp,
|
24
|
+
action => accept,
|
25
|
+
}
|
26
|
+
|
27
|
+
firewall { '102 allow puppet access':
|
28
|
+
dport => 8140,
|
29
|
+
proto => tcp,
|
30
|
+
action => accept,
|
31
|
+
}
|
32
|
+
|
33
|
+
$server_gems.each |$gem| {
|
34
|
+
package { "${gem}_server":
|
35
|
+
ensure => present,
|
36
|
+
name => $gem,
|
37
|
+
provider => 'puppetserver_gem',
|
38
|
+
notify => Service['pe-puppetserver'],
|
39
|
+
}
|
40
|
+
|
41
|
+
package { "${gem}_agent":
|
42
|
+
ensure => present,
|
43
|
+
name => $gem,
|
44
|
+
provider => 'puppet_gem',
|
45
|
+
notify => Service['pe-puppetserver'],
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
# Make sure that a user exists for me
|
50
|
+
rbac_user { 'dylan':
|
51
|
+
ensure => 'present',
|
52
|
+
display_name => 'Dylan Ratcliffe',
|
53
|
+
email => 'dylan.ratcliffe@puppet.com',
|
54
|
+
password => 'puppetlabs',
|
55
|
+
roles => [ 'Administrators' ],
|
56
|
+
}
|
57
|
+
|
58
|
+
# Create a Developers role
|
59
|
+
rbac_role { 'Developers':
|
60
|
+
ensure => 'present',
|
61
|
+
name => 'Developers',
|
62
|
+
description => 'Can run Puppet, deploy code and use PuppetDB',
|
63
|
+
permissions => [
|
64
|
+
{
|
65
|
+
'action' => 'run',
|
66
|
+
'instance' => '*',
|
67
|
+
'object_type' => 'puppet_agent'
|
68
|
+
}, {
|
69
|
+
'action' => 'modify_children',
|
70
|
+
'instance' => '*',
|
71
|
+
'object_type' => 'node_groups'
|
72
|
+
}, {
|
73
|
+
'action' => 'edit_child_rules',
|
74
|
+
'instance' => '*',
|
75
|
+
'object_type' => 'node_groups'
|
76
|
+
}, {
|
77
|
+
'action' => 'deploy_code',
|
78
|
+
'instance' => '*',
|
79
|
+
'object_type' => 'environment'
|
80
|
+
}, {
|
81
|
+
'action' => 'accept_reject',
|
82
|
+
'instance' => '*',
|
83
|
+
'object_type' => 'cert_requests'
|
84
|
+
}, {
|
85
|
+
'action' => 'edit_params_and_vars',
|
86
|
+
'instance' => '*',
|
87
|
+
'object_type' => 'node_groups'
|
88
|
+
}, {
|
89
|
+
'action' => 'edit_classification',
|
90
|
+
'instance' => '*',
|
91
|
+
'object_type' => 'node_groups'
|
92
|
+
}, {
|
93
|
+
'action' => 'view',
|
94
|
+
'instance' => '*',
|
95
|
+
'object_type' => 'node_groups'
|
96
|
+
}, {
|
97
|
+
'action' => 'view_data',
|
98
|
+
'instance' => '*',
|
99
|
+
'object_type' => 'nodes'
|
100
|
+
}, {
|
101
|
+
'action' => 'view',
|
102
|
+
'instance' => '*',
|
103
|
+
'object_type' => 'console_page'
|
104
|
+
}, {
|
105
|
+
'action' => 'set_environment',
|
106
|
+
'instance' => '*',
|
107
|
+
'object_type' => 'node_groups'
|
108
|
+
},
|
109
|
+
],
|
110
|
+
}
|
111
|
+
|
112
|
+
# Import all exported console users
|
113
|
+
Console::User <<| |>>
|
114
|
+
|
115
|
+
# Configure default color scheme for puppetmaster logs
|
116
|
+
file_line { 'log4j_color_puppetlogs':
|
117
|
+
ensure => present,
|
118
|
+
path => '/etc/multitail.conf',
|
119
|
+
line => 'scheme:log4j:/var/log/puppetlabs/',
|
120
|
+
after => 'default colorschemes',
|
121
|
+
require => Package['multitail'],
|
122
|
+
}
|
123
|
+
|
124
|
+
class { 'deployment_signature':
|
125
|
+
signing_secret => Sensitive('hunter2'),
|
126
|
+
validators => [
|
127
|
+
'/etc/puppetlabs/puppet/validate.sh',
|
128
|
+
],
|
129
|
+
}
|
130
|
+
|
131
|
+
# Create a validator tah always passes
|
132
|
+
file { '/etc/puppetlabs/puppet/validate.sh':
|
133
|
+
ensure => 'file',
|
134
|
+
owner => 'pe-puppet',
|
135
|
+
group => 'pe-puppet',
|
136
|
+
mode => '0700',
|
137
|
+
content => "#!/bin/bash\nexit 0",
|
138
|
+
}
|
139
|
+
}
|
data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sumologic.pp
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#
|
2
|
+
class profile::sumologic {
|
3
|
+
$sumologic_key = hiera('profile::sumologic::sumologic_key','NOT_FOUND')
|
4
|
+
|
5
|
+
# This data is completely made up, it will not work
|
6
|
+
class { '::sumologic::report_handler':
|
7
|
+
report_url => "https://collectors.au.sumologic.com/receiver/v1/http/${sumologic_key}",
|
8
|
+
mode => 'json',
|
9
|
+
notify => Service['pe-puppetserver'],
|
10
|
+
}
|
11
|
+
}
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# == Class: profile::sunburst::windows
|
2
|
+
#
|
3
|
+
class profile::sunburst::windows (
|
4
|
+
String $install_dir = 'C:/inetpub/sunburst',
|
5
|
+
String $user = 'sunburst',
|
6
|
+
String $group = 'sunburst-admins',
|
7
|
+
String $password = 'change3me',
|
8
|
+
) {
|
9
|
+
require ::profile::windows::webserver
|
10
|
+
|
11
|
+
user { $user:
|
12
|
+
ensure => present,
|
13
|
+
comment => 'Sunburst Application Service Account',
|
14
|
+
groups => ['Users',$group],
|
15
|
+
password => $password,
|
16
|
+
require => Group[$group],
|
17
|
+
}
|
18
|
+
|
19
|
+
group { $group:
|
20
|
+
ensure => present,
|
21
|
+
}
|
22
|
+
|
23
|
+
exec { 'grant_SeBatchLogonRight':
|
24
|
+
command => "Grant-Privilege -Identity ${user} -Privilege SeBatchLogonRight",
|
25
|
+
provider => 'powershell',
|
26
|
+
refreshonly => true,
|
27
|
+
subscribe => User[$user],
|
28
|
+
require => Package['carbon'],
|
29
|
+
}
|
30
|
+
|
31
|
+
iis_application_pool { 'sunburst':
|
32
|
+
ensure => present,
|
33
|
+
state => 'started',
|
34
|
+
identity_type => 'SpecificUser',
|
35
|
+
user_name => $user,
|
36
|
+
password => $password,
|
37
|
+
}
|
38
|
+
|
39
|
+
# Create a new website
|
40
|
+
iis_site { 'sunburst':
|
41
|
+
ensure => 'started',
|
42
|
+
physicalpath => 'C:\\inetpub\\sunburst',
|
43
|
+
applicationpool => 'sunburst',
|
44
|
+
defaultpage => 'index.html',
|
45
|
+
require => [Iis_application_pool['sunburst'], Dsc_windowsfeature['IIS','AspNet45']],
|
46
|
+
}
|
47
|
+
|
48
|
+
iis_virtual_directory { 'sunburst_vdir':
|
49
|
+
ensure => 'present',
|
50
|
+
sitename => 'sunburst',
|
51
|
+
physicalpath => 'C:\\inetpub\\sunburst',
|
52
|
+
require => File[$install_dir],
|
53
|
+
}
|
54
|
+
|
55
|
+
file { $install_dir:
|
56
|
+
ensure => directory,
|
57
|
+
}
|
58
|
+
|
59
|
+
acl { $install_dir:
|
60
|
+
inherit_parent_permissions => false,
|
61
|
+
purge => true,
|
62
|
+
owner => $user,
|
63
|
+
group => $group,
|
64
|
+
permissions => [
|
65
|
+
{
|
66
|
+
'affects' => 'all',
|
67
|
+
'identity' => 'NT AUTHORITY\SYSTEM',
|
68
|
+
'rights' => ['full'],
|
69
|
+
},
|
70
|
+
{
|
71
|
+
'affects' => 'all',
|
72
|
+
'identity' => 'BUILTIN\Administrators',
|
73
|
+
'rights' => ['full'],
|
74
|
+
},
|
75
|
+
{
|
76
|
+
'affects' => 'all',
|
77
|
+
'identity' => "${facts['hostname'].upcase}\\${user}",
|
78
|
+
'rights' => ['full'],
|
79
|
+
},
|
80
|
+
{
|
81
|
+
'affects' => 'all',
|
82
|
+
'identity' => "${facts['hostname'].upcase}\\${group}",
|
83
|
+
'rights' => ['read', 'execute'],
|
84
|
+
},
|
85
|
+
],
|
86
|
+
require => [User[$user],File[$install_dir]],
|
87
|
+
}
|
88
|
+
|
89
|
+
file { "${install_dir}/index.html":
|
90
|
+
ensure => file,
|
91
|
+
mode => '0644',
|
92
|
+
owner => $user,
|
93
|
+
group => $group,
|
94
|
+
source => 'puppet:///modules/profile/sunburst/index.html',
|
95
|
+
}
|
96
|
+
|
97
|
+
file { "${install_dir}/flare.json":
|
98
|
+
ensure => file,
|
99
|
+
mode => '0644',
|
100
|
+
owner => $user,
|
101
|
+
group => $group,
|
102
|
+
source => 'puppet:///modules/profile/sunburst/flare.json',
|
103
|
+
}
|
104
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# NOTE: This is old and failing tests
|
2
|
+
class profile::vagrant {
|
3
|
+
$version = '1.7.4'
|
4
|
+
|
5
|
+
file { ['/opt/vagrant','/opt/vagrant/packages']:
|
6
|
+
ensure => directory,
|
7
|
+
owner => 'root',
|
8
|
+
group => 'root',
|
9
|
+
mode => '0644',
|
10
|
+
}
|
11
|
+
|
12
|
+
archive::download { "vagrant_${version}_x86_64.rpm":
|
13
|
+
url => "https://releases.hashicorp.com/vagrant/1.7.4/vagrant_${version}_x86_64.rpm",
|
14
|
+
src_target => '/opt/vagrant/packages',
|
15
|
+
checksum => false,
|
16
|
+
require => File['/opt/vagrant/packages'],
|
17
|
+
}
|
18
|
+
|
19
|
+
class { '::vagrant':
|
20
|
+
ensure => 'present',
|
21
|
+
version => $version,
|
22
|
+
source => "/opt/vagrant/packages/vagrant_${version}_x86_64.rpm",
|
23
|
+
require => Archive::Download["vagrant_${version}_x86_64.rpm"],
|
24
|
+
}
|
25
|
+
}
|