cloud-mu 2.1.0beta → 3.0.0beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Berksfile +4 -5
- data/Berksfile.lock +179 -0
- data/README.md +1 -6
- data/ansible/roles/geerlingguy.firewall/templates/firewall.bash.j2 +0 -0
- data/ansible/roles/mu-installer/README.md +33 -0
- data/ansible/roles/mu-installer/defaults/main.yml +2 -0
- data/ansible/roles/mu-installer/handlers/main.yml +2 -0
- data/ansible/roles/mu-installer/meta/main.yml +60 -0
- data/ansible/roles/mu-installer/tasks/main.yml +13 -0
- data/ansible/roles/mu-installer/tests/inventory +2 -0
- data/ansible/roles/mu-installer/tests/test.yml +5 -0
- data/ansible/roles/mu-installer/vars/main.yml +2 -0
- data/bin/mu-adopt +125 -0
- data/bin/mu-aws-setup +4 -4
- data/bin/mu-azure-setup +265 -0
- data/bin/mu-azure-tests +43 -0
- data/bin/mu-cleanup +20 -8
- data/bin/mu-configure +224 -98
- data/bin/mu-deploy +8 -3
- data/bin/mu-gcp-setup +16 -8
- data/bin/mu-gen-docs +92 -8
- data/bin/mu-load-config.rb +52 -12
- data/bin/mu-momma-cat +36 -0
- data/bin/mu-node-manage +34 -27
- data/bin/mu-self-update +2 -2
- data/bin/mu-ssh +12 -8
- data/bin/mu-upload-chef-artifacts +11 -4
- data/bin/mu-user-manage +3 -0
- data/cloud-mu.gemspec +8 -11
- data/cookbooks/firewall/libraries/helpers_iptables.rb +2 -2
- data/cookbooks/firewall/metadata.json +1 -1
- data/cookbooks/firewall/recipes/default.rb +5 -9
- data/cookbooks/mu-firewall/attributes/default.rb +2 -0
- data/cookbooks/mu-firewall/metadata.rb +1 -1
- data/cookbooks/mu-glusterfs/templates/default/mu-gluster-client.erb +0 -0
- data/cookbooks/mu-master/Berksfile +2 -2
- data/cookbooks/mu-master/files/default/check_mem.pl +0 -0
- data/cookbooks/mu-master/files/default/cloudamatic.png +0 -0
- data/cookbooks/mu-master/metadata.rb +5 -4
- data/cookbooks/mu-master/recipes/389ds.rb +1 -1
- data/cookbooks/mu-master/recipes/basepackages.rb +30 -10
- data/cookbooks/mu-master/recipes/default.rb +59 -7
- data/cookbooks/mu-master/recipes/firewall-holes.rb +1 -1
- data/cookbooks/mu-master/recipes/init.rb +65 -47
- data/cookbooks/mu-master/recipes/{eks-kubectl.rb → kubectl.rb} +4 -10
- data/cookbooks/mu-master/recipes/sssd.rb +2 -1
- data/cookbooks/mu-master/recipes/update_nagios_only.rb +6 -6
- data/cookbooks/mu-master/templates/default/web_app.conf.erb +2 -2
- data/cookbooks/mu-master/templates/mods/ldap.conf.erb +4 -0
- data/cookbooks/mu-php54/Berksfile +1 -2
- data/cookbooks/mu-php54/metadata.rb +4 -5
- data/cookbooks/mu-php54/recipes/default.rb +1 -1
- data/cookbooks/mu-splunk/templates/default/splunk-init.erb +0 -0
- data/cookbooks/mu-tools/Berksfile +3 -2
- data/cookbooks/mu-tools/files/default/Mu_CA.pem +33 -0
- data/cookbooks/mu-tools/libraries/helper.rb +20 -8
- data/cookbooks/mu-tools/metadata.rb +5 -2
- data/cookbooks/mu-tools/recipes/apply_security.rb +2 -3
- data/cookbooks/mu-tools/recipes/eks.rb +1 -1
- data/cookbooks/mu-tools/recipes/gcloud.rb +5 -30
- data/cookbooks/mu-tools/recipes/nagios.rb +1 -1
- data/cookbooks/mu-tools/recipes/rsyslog.rb +1 -0
- data/cookbooks/mu-tools/recipes/selinux.rb +19 -0
- data/cookbooks/mu-tools/recipes/split_var_partitions.rb +0 -1
- data/cookbooks/mu-tools/recipes/windows-client.rb +256 -122
- data/cookbooks/mu-tools/resources/disk.rb +3 -1
- data/cookbooks/mu-tools/templates/amazon/sshd_config.erb +1 -1
- data/cookbooks/mu-tools/templates/default/etc_hosts.erb +1 -1
- data/cookbooks/mu-tools/templates/default/{kubeconfig.erb → kubeconfig-eks.erb} +0 -0
- data/cookbooks/mu-tools/templates/default/kubeconfig-gke.erb +27 -0
- data/cookbooks/mu-tools/templates/windows-10/sshd_config.erb +137 -0
- data/cookbooks/mu-utility/recipes/nat.rb +4 -0
- data/extras/alpha.png +0 -0
- data/extras/beta.png +0 -0
- data/extras/clean-stock-amis +2 -2
- data/extras/generate-stock-images +131 -0
- data/extras/git-fix-permissions-hook +0 -0
- data/extras/image-generators/AWS/centos6.yaml +17 -0
- data/extras/image-generators/{aws → AWS}/centos7-govcloud.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/centos7.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/rhel7.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/win2k12.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/win2k16.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/windows.yaml +0 -0
- data/extras/image-generators/{gcp → Google}/centos6.yaml +1 -0
- data/extras/image-generators/Google/centos7.yaml +18 -0
- data/extras/python_rpm/build.sh +0 -0
- data/extras/release.png +0 -0
- data/extras/ruby_rpm/build.sh +0 -0
- data/extras/ruby_rpm/muby.spec +1 -1
- data/install/README.md +43 -5
- data/install/deprecated-bash-library.sh +0 -0
- data/install/installer +1 -1
- data/install/jenkinskeys.rb +0 -0
- data/install/mu-master.yaml +55 -0
- data/modules/mommacat.ru +41 -7
- data/modules/mu.rb +444 -149
- data/modules/mu/adoption.rb +500 -0
- data/modules/mu/cleanup.rb +235 -158
- data/modules/mu/cloud.rb +675 -138
- data/modules/mu/clouds/aws.rb +156 -24
- data/modules/mu/clouds/aws/alarm.rb +4 -14
- data/modules/mu/clouds/aws/bucket.rb +60 -18
- data/modules/mu/clouds/aws/cache_cluster.rb +8 -20
- data/modules/mu/clouds/aws/collection.rb +12 -22
- data/modules/mu/clouds/aws/container_cluster.rb +209 -118
- data/modules/mu/clouds/aws/database.rb +120 -45
- data/modules/mu/clouds/aws/dnszone.rb +7 -18
- data/modules/mu/clouds/aws/endpoint.rb +5 -15
- data/modules/mu/clouds/aws/firewall_rule.rb +144 -72
- data/modules/mu/clouds/aws/folder.rb +4 -11
- data/modules/mu/clouds/aws/function.rb +6 -16
- data/modules/mu/clouds/aws/group.rb +4 -12
- data/modules/mu/clouds/aws/habitat.rb +11 -13
- data/modules/mu/clouds/aws/loadbalancer.rb +40 -28
- data/modules/mu/clouds/aws/log.rb +5 -13
- data/modules/mu/clouds/aws/msg_queue.rb +9 -24
- data/modules/mu/clouds/aws/nosqldb.rb +4 -12
- data/modules/mu/clouds/aws/notifier.rb +6 -13
- data/modules/mu/clouds/aws/role.rb +69 -40
- data/modules/mu/clouds/aws/search_domain.rb +17 -20
- data/modules/mu/clouds/aws/server.rb +184 -94
- data/modules/mu/clouds/aws/server_pool.rb +33 -38
- data/modules/mu/clouds/aws/storage_pool.rb +5 -12
- data/modules/mu/clouds/aws/user.rb +59 -33
- data/modules/mu/clouds/aws/userdata/linux.erb +18 -30
- data/modules/mu/clouds/aws/userdata/windows.erb +9 -9
- data/modules/mu/clouds/aws/vpc.rb +214 -145
- data/modules/mu/clouds/azure.rb +978 -44
- data/modules/mu/clouds/azure/container_cluster.rb +413 -0
- data/modules/mu/clouds/azure/firewall_rule.rb +500 -0
- data/modules/mu/clouds/azure/habitat.rb +167 -0
- data/modules/mu/clouds/azure/loadbalancer.rb +205 -0
- data/modules/mu/clouds/azure/role.rb +211 -0
- data/modules/mu/clouds/azure/server.rb +810 -0
- data/modules/mu/clouds/azure/user.rb +257 -0
- data/modules/mu/clouds/azure/userdata/README.md +4 -0
- data/modules/mu/clouds/azure/userdata/linux.erb +137 -0
- data/modules/mu/clouds/azure/userdata/windows.erb +275 -0
- data/modules/mu/clouds/azure/vpc.rb +782 -0
- data/modules/mu/clouds/cloudformation.rb +12 -9
- data/modules/mu/clouds/cloudformation/firewall_rule.rb +5 -13
- data/modules/mu/clouds/cloudformation/server.rb +10 -1
- data/modules/mu/clouds/cloudformation/server_pool.rb +1 -0
- data/modules/mu/clouds/cloudformation/vpc.rb +0 -2
- data/modules/mu/clouds/google.rb +554 -117
- data/modules/mu/clouds/google/bucket.rb +173 -32
- data/modules/mu/clouds/google/container_cluster.rb +1112 -157
- data/modules/mu/clouds/google/database.rb +24 -47
- data/modules/mu/clouds/google/firewall_rule.rb +344 -89
- data/modules/mu/clouds/google/folder.rb +156 -79
- data/modules/mu/clouds/google/group.rb +272 -82
- data/modules/mu/clouds/google/habitat.rb +177 -52
- data/modules/mu/clouds/google/loadbalancer.rb +9 -34
- data/modules/mu/clouds/google/role.rb +1211 -0
- data/modules/mu/clouds/google/server.rb +491 -227
- data/modules/mu/clouds/google/server_pool.rb +233 -48
- data/modules/mu/clouds/google/user.rb +479 -125
- data/modules/mu/clouds/google/userdata/linux.erb +3 -3
- data/modules/mu/clouds/google/userdata/windows.erb +9 -9
- data/modules/mu/clouds/google/vpc.rb +381 -223
- data/modules/mu/config.rb +689 -214
- data/modules/mu/config/bucket.rb +1 -1
- data/modules/mu/config/cache_cluster.rb +1 -1
- data/modules/mu/config/cache_cluster.yml +0 -4
- data/modules/mu/config/container_cluster.rb +18 -9
- data/modules/mu/config/database.rb +6 -23
- data/modules/mu/config/firewall_rule.rb +9 -15
- data/modules/mu/config/folder.rb +22 -21
- data/modules/mu/config/habitat.rb +22 -21
- data/modules/mu/config/loadbalancer.rb +2 -2
- data/modules/mu/config/role.rb +9 -40
- data/modules/mu/config/server.rb +26 -5
- data/modules/mu/config/server_pool.rb +1 -1
- data/modules/mu/config/storage_pool.rb +2 -2
- data/modules/mu/config/user.rb +4 -0
- data/modules/mu/config/vpc.rb +350 -110
- data/modules/mu/defaults/{amazon_images.yaml → AWS.yaml} +37 -39
- data/modules/mu/defaults/Azure.yaml +17 -0
- data/modules/mu/defaults/Google.yaml +24 -0
- data/modules/mu/defaults/README.md +1 -1
- data/modules/mu/deploy.rb +168 -125
- data/modules/mu/groomer.rb +2 -1
- data/modules/mu/groomers/ansible.rb +104 -32
- data/modules/mu/groomers/chef.rb +96 -44
- data/modules/mu/kittens.rb +20602 -0
- data/modules/mu/logger.rb +38 -11
- data/modules/mu/master.rb +90 -8
- data/modules/mu/master/chef.rb +2 -3
- data/modules/mu/master/ldap.rb +0 -1
- data/modules/mu/master/ssl.rb +250 -0
- data/modules/mu/mommacat.rb +917 -513
- data/modules/scratchpad.erb +1 -1
- data/modules/tests/super_complex_bok.yml +0 -0
- data/modules/tests/super_simple_bok.yml +0 -0
- data/roles/mu-master.json +2 -1
- data/spec/azure_creds +5 -0
- data/spec/mu.yaml +56 -0
- data/spec/mu/clouds/azure_spec.rb +164 -27
- data/spec/spec_helper.rb +5 -0
- data/test/clean_up.py +0 -0
- data/test/exec_inspec.py +0 -0
- data/test/exec_mu_install.py +0 -0
- data/test/exec_retry.py +0 -0
- data/test/smoke_test.rb +0 -0
- metadata +90 -118
- data/cookbooks/mu-jenkins/Berksfile +0 -14
- data/cookbooks/mu-jenkins/CHANGELOG.md +0 -13
- data/cookbooks/mu-jenkins/LICENSE +0 -37
- data/cookbooks/mu-jenkins/README.md +0 -105
- data/cookbooks/mu-jenkins/attributes/default.rb +0 -42
- data/cookbooks/mu-jenkins/files/default/cleanup_deploy_config.xml +0 -73
- data/cookbooks/mu-jenkins/files/default/deploy_config.xml +0 -44
- data/cookbooks/mu-jenkins/metadata.rb +0 -21
- data/cookbooks/mu-jenkins/recipes/default.rb +0 -195
- data/cookbooks/mu-jenkins/recipes/node-ssh-config.rb +0 -54
- data/cookbooks/mu-jenkins/recipes/public_key.rb +0 -24
- data/cookbooks/mu-jenkins/templates/default/example_job.config.xml.erb +0 -24
- data/cookbooks/mu-jenkins/templates/default/org.jvnet.hudson.plugins.SSHBuildWrapper.xml.erb +0 -14
- data/cookbooks/mu-jenkins/templates/default/ssh_config.erb +0 -6
- data/cookbooks/nagios/Berksfile +0 -11
- data/cookbooks/nagios/CHANGELOG.md +0 -589
- data/cookbooks/nagios/CONTRIBUTING.md +0 -11
- data/cookbooks/nagios/LICENSE +0 -37
- data/cookbooks/nagios/README.md +0 -328
- data/cookbooks/nagios/TESTING.md +0 -2
- data/cookbooks/nagios/attributes/config.rb +0 -171
- data/cookbooks/nagios/attributes/default.rb +0 -228
- data/cookbooks/nagios/chefignore +0 -102
- data/cookbooks/nagios/definitions/command.rb +0 -33
- data/cookbooks/nagios/definitions/contact.rb +0 -33
- data/cookbooks/nagios/definitions/contactgroup.rb +0 -33
- data/cookbooks/nagios/definitions/host.rb +0 -33
- data/cookbooks/nagios/definitions/hostdependency.rb +0 -33
- data/cookbooks/nagios/definitions/hostescalation.rb +0 -34
- data/cookbooks/nagios/definitions/hostgroup.rb +0 -33
- data/cookbooks/nagios/definitions/nagios_conf.rb +0 -38
- data/cookbooks/nagios/definitions/resource.rb +0 -33
- data/cookbooks/nagios/definitions/service.rb +0 -33
- data/cookbooks/nagios/definitions/servicedependency.rb +0 -33
- data/cookbooks/nagios/definitions/serviceescalation.rb +0 -34
- data/cookbooks/nagios/definitions/servicegroup.rb +0 -33
- data/cookbooks/nagios/definitions/timeperiod.rb +0 -33
- data/cookbooks/nagios/libraries/base.rb +0 -314
- data/cookbooks/nagios/libraries/command.rb +0 -91
- data/cookbooks/nagios/libraries/contact.rb +0 -230
- data/cookbooks/nagios/libraries/contactgroup.rb +0 -112
- data/cookbooks/nagios/libraries/custom_option.rb +0 -36
- data/cookbooks/nagios/libraries/data_bag_helper.rb +0 -23
- data/cookbooks/nagios/libraries/default.rb +0 -90
- data/cookbooks/nagios/libraries/host.rb +0 -412
- data/cookbooks/nagios/libraries/hostdependency.rb +0 -181
- data/cookbooks/nagios/libraries/hostescalation.rb +0 -173
- data/cookbooks/nagios/libraries/hostgroup.rb +0 -119
- data/cookbooks/nagios/libraries/nagios.rb +0 -282
- data/cookbooks/nagios/libraries/resource.rb +0 -59
- data/cookbooks/nagios/libraries/service.rb +0 -455
- data/cookbooks/nagios/libraries/servicedependency.rb +0 -215
- data/cookbooks/nagios/libraries/serviceescalation.rb +0 -195
- data/cookbooks/nagios/libraries/servicegroup.rb +0 -144
- data/cookbooks/nagios/libraries/timeperiod.rb +0 -160
- data/cookbooks/nagios/libraries/users_helper.rb +0 -54
- data/cookbooks/nagios/metadata.rb +0 -25
- data/cookbooks/nagios/recipes/_load_databag_config.rb +0 -153
- data/cookbooks/nagios/recipes/_load_default_config.rb +0 -241
- data/cookbooks/nagios/recipes/apache.rb +0 -48
- data/cookbooks/nagios/recipes/default.rb +0 -204
- data/cookbooks/nagios/recipes/nginx.rb +0 -82
- data/cookbooks/nagios/recipes/pagerduty.rb +0 -143
- data/cookbooks/nagios/recipes/server_package.rb +0 -40
- data/cookbooks/nagios/recipes/server_source.rb +0 -164
- data/cookbooks/nagios/templates/default/apache2.conf.erb +0 -96
- data/cookbooks/nagios/templates/default/cgi.cfg.erb +0 -266
- data/cookbooks/nagios/templates/default/commands.cfg.erb +0 -13
- data/cookbooks/nagios/templates/default/contacts.cfg.erb +0 -37
- data/cookbooks/nagios/templates/default/hostgroups.cfg.erb +0 -25
- data/cookbooks/nagios/templates/default/hosts.cfg.erb +0 -15
- data/cookbooks/nagios/templates/default/htpasswd.users.erb +0 -6
- data/cookbooks/nagios/templates/default/nagios.cfg.erb +0 -22
- data/cookbooks/nagios/templates/default/nginx.conf.erb +0 -62
- data/cookbooks/nagios/templates/default/pagerduty.cgi.erb +0 -185
- data/cookbooks/nagios/templates/default/resource.cfg.erb +0 -27
- data/cookbooks/nagios/templates/default/servicedependencies.cfg.erb +0 -15
- data/cookbooks/nagios/templates/default/servicegroups.cfg.erb +0 -14
- data/cookbooks/nagios/templates/default/services.cfg.erb +0 -14
- data/cookbooks/nagios/templates/default/templates.cfg.erb +0 -31
- data/cookbooks/nagios/templates/default/timeperiods.cfg.erb +0 -13
- data/extras/image-generators/aws/centos6.yaml +0 -18
- data/modules/mu/defaults/google_images.yaml +0 -16
- data/roles/mu-master-jenkins.json +0 -24
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Author:: Tim Smith <tsmith@chef.io>
|
|
3
|
-
# Cookbook Name:: nagios
|
|
4
|
-
# Recipe:: apache
|
|
5
|
-
#
|
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
# you may not use this file except in compliance with the License.
|
|
8
|
-
# You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
include_recipe 'apache2'
|
|
20
|
-
include_recipe 'apache2::mod_rewrite'
|
|
21
|
-
include_recipe 'apache2::mod_php5'
|
|
22
|
-
include_recipe 'apache2::mod_ssl' if node['nagios']['enable_ssl']
|
|
23
|
-
|
|
24
|
-
apache_site '000-default' do
|
|
25
|
-
enable false
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
apache_module 'cgi'
|
|
29
|
-
|
|
30
|
-
template "#{node['apache']['dir']}/sites-available/#{node['nagios']['server']['vname']}.conf" do
|
|
31
|
-
source 'apache2.conf.erb'
|
|
32
|
-
mode '0644'
|
|
33
|
-
variables(
|
|
34
|
-
nagios_url: node['nagios']['url'],
|
|
35
|
-
https: node['nagios']['enable_ssl'],
|
|
36
|
-
ssl_cert_file: node['nagios']['ssl_cert_file'],
|
|
37
|
-
ssl_cert_key: node['nagios']['ssl_cert_key']
|
|
38
|
-
)
|
|
39
|
-
if File.symlink?("#{node['apache']['dir']}/sites-enabled/#{node['nagios']['server']['vname']}.conf")
|
|
40
|
-
notifies :reload, 'service[apache2]'
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
file "#{node['apache']['dir']}/conf.d/#{node['nagios']['server']['vname']}.conf" do
|
|
45
|
-
action :delete
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
apache_site node['nagios']['server']['vname']
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Author:: Joshua Sierles <joshua@37signals.com>
|
|
3
|
-
# Author:: Joshua Timberman <joshua@getchef.com>
|
|
4
|
-
# Author:: Nathan Haneysmith <nathan@getchef.com>
|
|
5
|
-
# Author:: Seth Chisamore <schisamo@getchef.com>
|
|
6
|
-
# Author:: Tim Smith <tsmith@chef.io>
|
|
7
|
-
# Cookbook Name:: nagios
|
|
8
|
-
# Recipe:: default
|
|
9
|
-
#
|
|
10
|
-
# Copyright 2009, 37signals
|
|
11
|
-
# Copyright 2009-2016, Chef Software, Inc.
|
|
12
|
-
# Copyright 2013-2014, Limelight Networks, Inc.
|
|
13
|
-
#
|
|
14
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
-
# you may not use this file except in compliance with the License.
|
|
16
|
-
# You may obtain a copy of the License at
|
|
17
|
-
#
|
|
18
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
#
|
|
20
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
21
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
-
# See the License for the specific language governing permissions and
|
|
24
|
-
# limitations under the License.
|
|
25
|
-
|
|
26
|
-
# workaround to allow for a nagios server install from source using the override attribute on debian/ubuntu (COOK-2350)
|
|
27
|
-
nagios_service_name = if platform_family?('debian') && node['nagios']['server']['install_method'] == 'source'
|
|
28
|
-
node['nagios']['server']['name']
|
|
29
|
-
else
|
|
30
|
-
node['nagios']['server']['service_name']
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# install nagios service either from source of package
|
|
34
|
-
include_recipe "nagios::server_#{node['nagios']['server']['install_method']}"
|
|
35
|
-
|
|
36
|
-
# configure either Apache2 or NGINX
|
|
37
|
-
case node['nagios']['server']['web_server']
|
|
38
|
-
when 'nginx'
|
|
39
|
-
Chef::Log.info 'Setting up Nagios server via NGINX'
|
|
40
|
-
include_recipe 'nagios::nginx'
|
|
41
|
-
web_user = node['nginx']['user']
|
|
42
|
-
web_group = node['nginx']['group'] || web_user
|
|
43
|
-
when 'apache'
|
|
44
|
-
Chef::Log.info 'Setting up Nagios server via Apache2'
|
|
45
|
-
include_recipe 'nagios::apache'
|
|
46
|
-
web_user = node['apache']['user']
|
|
47
|
-
web_group = node['apache']['group'] || web_user
|
|
48
|
-
else
|
|
49
|
-
Chef::Log.fatal('Unknown web server option provided for Nagios server: ' \
|
|
50
|
-
"#{node['nagios']['server']['web_server']} provided. Allowed: 'nginx' or 'apache'")
|
|
51
|
-
raise 'Unknown web server option provided for Nagios server'
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# use the users_helper.rb library to build arrays of users and contacts
|
|
55
|
-
nagios_users = NagiosUsers.new(node)
|
|
56
|
-
|
|
57
|
-
Chef::Log.fatal("Could not find users in the \"#{node['nagios']['users_databag']}\" databag with the \"#{node['nagios']['users_databag_group']}\"" \
|
|
58
|
-
' group. Users must be defined to allow for logins to the UI. Make sure the databag exists and, if you have set the ' \
|
|
59
|
-
'"users_databag_group", that users in that group exist.') if nagios_users.users.empty?
|
|
60
|
-
|
|
61
|
-
# configure the appropriate authentication method for the web server
|
|
62
|
-
case node['nagios']['server_auth_method']
|
|
63
|
-
when 'openid'
|
|
64
|
-
if node['nagios']['server']['web_server'] == 'apache'
|
|
65
|
-
include_recipe 'apache2::mod_auth_openid'
|
|
66
|
-
else
|
|
67
|
-
Chef::Log.fatal('OpenID authentication for Nagios is not supported on NGINX')
|
|
68
|
-
Chef::Log.fatal("Set node['nagios']['server_auth_method'] attribute in your Nagios role")
|
|
69
|
-
raise 'OpenID authentication not supported on NGINX'
|
|
70
|
-
end
|
|
71
|
-
when 'cas'
|
|
72
|
-
if node['nagios']['server']['web_server'] == 'apache'
|
|
73
|
-
include_recipe 'apache2::mod_auth_cas'
|
|
74
|
-
else
|
|
75
|
-
Chef::Log.fatal('CAS authentication for Nagios is not supported on NGINX')
|
|
76
|
-
Chef::Log.fatal("Set node['nagios']['server_auth_method'] attribute in your Nagios role")
|
|
77
|
-
raise 'CAS authentivation not supported on NGINX'
|
|
78
|
-
end
|
|
79
|
-
when 'ldap'
|
|
80
|
-
if node['nagios']['server']['web_server'] == 'apache'
|
|
81
|
-
include_recipe 'apache2::mod_authnz_ldap'
|
|
82
|
-
else
|
|
83
|
-
Chef::Log.fatal('LDAP authentication for Nagios is not supported on NGINX')
|
|
84
|
-
Chef::Log.fatal("Set node['nagios']['server_auth_method'] attribute in your Nagios role")
|
|
85
|
-
raise 'LDAP authentication not supported on NGINX'
|
|
86
|
-
end
|
|
87
|
-
else
|
|
88
|
-
# setup htpasswd auth
|
|
89
|
-
directory node['nagios']['conf_dir']
|
|
90
|
-
|
|
91
|
-
template "#{node['nagios']['conf_dir']}/htpasswd.users" do
|
|
92
|
-
source 'htpasswd.users.erb'
|
|
93
|
-
owner node['nagios']['user']
|
|
94
|
-
group web_group
|
|
95
|
-
mode '0640'
|
|
96
|
-
variables(nagios_users: nagios_users.users)
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
# Setting all general options
|
|
101
|
-
unless node['nagios'].nil?
|
|
102
|
-
unless node['nagios']['server'].nil?
|
|
103
|
-
Nagios.instance.normalize_hostname = node['nagios']['server']['normalize_hostname']
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
Nagios.instance.host_name_attribute = node['nagios']['host_name_attribute']
|
|
108
|
-
|
|
109
|
-
# loading default configuration data
|
|
110
|
-
if node['nagios']['server']['load_default_config']
|
|
111
|
-
include_recipe 'nagios::_load_default_config'
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
# loading all databag configurations
|
|
115
|
-
if node['nagios']['server']['load_databag_config']
|
|
116
|
-
include_recipe 'nagios::_load_databag_config'
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
directory "#{node['nagios']['conf_dir']}/dist" do
|
|
120
|
-
owner node['nagios']['user']
|
|
121
|
-
group node['nagios']['group']
|
|
122
|
-
mode '0755'
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
directory node['nagios']['state_dir'] do
|
|
126
|
-
owner node['nagios']['user']
|
|
127
|
-
group node['nagios']['group']
|
|
128
|
-
mode '0751'
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
directory "#{node['nagios']['state_dir']}/rw" do
|
|
132
|
-
owner node['nagios']['user']
|
|
133
|
-
group web_group
|
|
134
|
-
mode '2710'
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
execute 'archive-default-nagios-object-definitions' do
|
|
138
|
-
command "mv #{node['nagios']['config_dir']}/*_#{node['nagios']['server']['name']}*.cfg #{node['nagios']['conf_dir']}/dist"
|
|
139
|
-
not_if { Dir.glob("#{node['nagios']['config_dir']}/*_#{node['nagios']['server']['name']}*.cfg").empty? }
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
directory "#{node['nagios']['conf_dir']}/certificates" do
|
|
143
|
-
owner web_user
|
|
144
|
-
group web_group
|
|
145
|
-
mode '0700'
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
ssl_code = "umask 077
|
|
149
|
-
openssl genrsa 2048 > nagios-server.key
|
|
150
|
-
openssl req -subj #{node['nagios']['ssl_req']} -new -x509 -nodes -sha1 -days 3650 -key nagios-server.key > nagios-server.crt
|
|
151
|
-
cat nagios-server.key nagios-server.crt > nagios-server.pem"
|
|
152
|
-
|
|
153
|
-
bash 'Create SSL Certificates' do
|
|
154
|
-
cwd "#{node['nagios']['conf_dir']}/certificates"
|
|
155
|
-
code ssl_code
|
|
156
|
-
not_if { ::File.exist?(node['nagios']['ssl_cert_file']) }
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
nagios_conf node['nagios']['server']['name'] do
|
|
160
|
-
config_subdir false
|
|
161
|
-
source 'nagios.cfg.erb'
|
|
162
|
-
variables(nagios_config: node['nagios']['conf'])
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
nagios_conf 'cgi' do
|
|
166
|
-
config_subdir false
|
|
167
|
-
variables(nagios_service_name: nagios_service_name)
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
# resource.cfg differs on RPM and tarball based systems
|
|
171
|
-
if node['platform_family'] == 'rhel' || node['platform_family'] == 'fedora'
|
|
172
|
-
template "#{node['nagios']['resource_dir']}/resource.cfg" do
|
|
173
|
-
source 'resource.cfg.erb'
|
|
174
|
-
owner node['nagios']['user']
|
|
175
|
-
group node['nagios']['group']
|
|
176
|
-
mode '0600'
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
directory node['nagios']['resource_dir'] do
|
|
180
|
-
owner 'root'
|
|
181
|
-
group node['nagios']['group']
|
|
182
|
-
mode '0755'
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
nagios_conf 'timeperiods'
|
|
187
|
-
nagios_conf 'contacts'
|
|
188
|
-
nagios_conf 'commands'
|
|
189
|
-
nagios_conf 'hosts'
|
|
190
|
-
nagios_conf 'hostgroups'
|
|
191
|
-
nagios_conf 'templates'
|
|
192
|
-
nagios_conf 'services'
|
|
193
|
-
nagios_conf 'servicegroups'
|
|
194
|
-
nagios_conf 'servicedependencies'
|
|
195
|
-
|
|
196
|
-
zap_directory node['nagios']['config_dir'] do
|
|
197
|
-
pattern '*.cfg'
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
service 'nagios' do
|
|
201
|
-
service_name nagios_service_name
|
|
202
|
-
supports status: true, restart: true, reload: true
|
|
203
|
-
action [:enable, :start]
|
|
204
|
-
end
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Author:: Tim Smith <tsmith@chef.io>
|
|
3
|
-
# Cookbook Name:: nagios
|
|
4
|
-
# Recipe:: nginx
|
|
5
|
-
#
|
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
# you may not use this file except in compliance with the License.
|
|
8
|
-
# You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
if node['nagios']['server']['stop_apache']
|
|
20
|
-
service 'apache2' do
|
|
21
|
-
action :stop
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# This doesn't use value_for_platform_family so that it can specify version ranges - COOK-2891
|
|
26
|
-
if platform_family?('rhel') || platform_family?('fedora')
|
|
27
|
-
node.normal['nagios']['server']['nginx_dispatch'] = 'both'
|
|
28
|
-
if node['platform_version'].to_f < 6
|
|
29
|
-
node.normal['nginx']['install_method'] = 'source'
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
include_recipe 'chef_nginx'
|
|
34
|
-
|
|
35
|
-
%w(default 000-default).each do |disable_site|
|
|
36
|
-
nginx_site disable_site do
|
|
37
|
-
enable false
|
|
38
|
-
notifies :reload, 'service[nginx]'
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
case dispatch_type = node['nagios']['server']['nginx_dispatch']
|
|
43
|
-
when 'cgi'
|
|
44
|
-
node.normal['nginx_simplecgi']['cgi'] = true
|
|
45
|
-
include_recipe 'nginx_simplecgi::setup'
|
|
46
|
-
when 'php'
|
|
47
|
-
node.normal['nginx_simplecgi']['php'] = true
|
|
48
|
-
include_recipe 'nginx_simplecgi::setup'
|
|
49
|
-
when 'both'
|
|
50
|
-
node.normal['nginx_simplecgi']['php'] = true
|
|
51
|
-
node.normal['nginx_simplecgi']['cgi'] = true
|
|
52
|
-
include_recipe 'nginx_simplecgi::setup'
|
|
53
|
-
else
|
|
54
|
-
Chef::Log.warn 'NAGIOS: NGINX setup does not have a dispatcher provided'
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
template File.join(node['nginx']['dir'], 'sites-available', 'nagios3.conf') do
|
|
58
|
-
source 'nginx.conf.erb'
|
|
59
|
-
mode '0644'
|
|
60
|
-
variables(
|
|
61
|
-
public_domain: node['public_domain'] || node['domain'],
|
|
62
|
-
listen_port: node['nagios']['http_port'],
|
|
63
|
-
https: node['nagios']['enable_ssl'],
|
|
64
|
-
ssl_cert_file: node['nagios']['ssl_cert_file'],
|
|
65
|
-
ssl_cert_key: node['nagios']['ssl_cert_key'],
|
|
66
|
-
docroot: node['nagios']['docroot'],
|
|
67
|
-
log_dir: node['nagios']['log_dir'],
|
|
68
|
-
fqdn: node['fqdn'],
|
|
69
|
-
nagios_url: node['nagios']['url'],
|
|
70
|
-
chef_env: node.chef_environment == '_default' ? 'default' : node.chef_environment,
|
|
71
|
-
htpasswd_file: File.join(node['nagios']['conf_dir'], 'htpasswd.users'),
|
|
72
|
-
cgi: %w(cgi both).include?(dispatch_type),
|
|
73
|
-
php: %w(php both).include?(dispatch_type)
|
|
74
|
-
)
|
|
75
|
-
if File.symlink?(File.join(node['nginx']['dir'], 'sites-enabled', 'nagios3.conf'))
|
|
76
|
-
notifies :reload, 'service[nginx]', :immediately
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
nginx_site 'nagios3.conf' do
|
|
81
|
-
notifies :reload, 'service[nginx]'
|
|
82
|
-
end
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Author:: Jake Vanderdray <jvanderdray@customink.com>
|
|
3
|
-
# Author:: Tim Smith <tsmith@chef.io>
|
|
4
|
-
# Cookbook Name:: nagios
|
|
5
|
-
# Recipe:: pagerduty
|
|
6
|
-
#
|
|
7
|
-
# Copyright 2011, CustomInk LLC
|
|
8
|
-
#
|
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
# you may not use this file except in compliance with the License.
|
|
11
|
-
# You may obtain a copy of the License at
|
|
12
|
-
#
|
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
#
|
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
# See the License for the specific language governing permissions and
|
|
19
|
-
# limitations under the License.
|
|
20
|
-
|
|
21
|
-
# TODO: remove when backward compatibility is dropped.
|
|
22
|
-
def using_old_pagerduty_key_attribute?
|
|
23
|
-
node['nagios']['pagerduty_key'] &&
|
|
24
|
-
node['nagios']['pagerduty_key'] != node['nagios']['pagerduty']['key']
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
if using_old_pagerduty_key_attribute?
|
|
28
|
-
Chef::Log.warn('The nagios.pagerduty_key attribute is deprecated. It is replaced by the nagios.pagerduty.key attribute.')
|
|
29
|
-
Chef::Log.warn('Assigning nagios.pagerduty.key from nagios.pagerduty_key now.')
|
|
30
|
-
node.normal['nagios']['pagerduty']['key'] = node['nagios']['pagerduty_key']
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
package 'perl-CGI' do
|
|
34
|
-
case node['platform_family']
|
|
35
|
-
when 'rhel', 'fedora'
|
|
36
|
-
package_name 'perl-CGI'
|
|
37
|
-
when 'debian'
|
|
38
|
-
package_name 'libcgi-pm-perl'
|
|
39
|
-
when 'arch'
|
|
40
|
-
package_name 'perl-cgi'
|
|
41
|
-
end
|
|
42
|
-
action :install
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
package 'perl-JSON' do
|
|
46
|
-
case node['platform_family']
|
|
47
|
-
when 'rhel', 'fedora'
|
|
48
|
-
package_name 'perl-JSON'
|
|
49
|
-
when 'debian'
|
|
50
|
-
package_name 'libjson-perl'
|
|
51
|
-
when 'arch'
|
|
52
|
-
package_name 'perl-json'
|
|
53
|
-
end
|
|
54
|
-
action :install
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
package 'libwww-perl' do
|
|
58
|
-
case node['platform_family']
|
|
59
|
-
when 'rhel', 'fedora'
|
|
60
|
-
package_name 'perl-libwww-perl'
|
|
61
|
-
when 'debian'
|
|
62
|
-
package_name 'libwww-perl'
|
|
63
|
-
when 'arch'
|
|
64
|
-
package_name 'libwww-perl'
|
|
65
|
-
end
|
|
66
|
-
action :install
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
package 'libcrypt-ssleay-perl' do
|
|
70
|
-
case node['platform_family']
|
|
71
|
-
when 'rhel', 'fedora'
|
|
72
|
-
package_name 'perl-Crypt-SSLeay'
|
|
73
|
-
when 'debian'
|
|
74
|
-
package_name 'libcrypt-ssleay-perl'
|
|
75
|
-
when 'arch'
|
|
76
|
-
package_name 'libcrypt-ssleay-perl'
|
|
77
|
-
end
|
|
78
|
-
action :install
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
remote_file "#{node['nagios']['plugin_dir']}/notify_pagerduty.pl" do
|
|
82
|
-
owner 'root'
|
|
83
|
-
group 'root'
|
|
84
|
-
mode '0755'
|
|
85
|
-
source node['nagios']['pagerduty']['script_url']
|
|
86
|
-
action :create_if_missing
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
template "#{node['nagios']['cgi-bin']}/pagerduty.cgi" do
|
|
90
|
-
source 'pagerduty.cgi.erb'
|
|
91
|
-
owner node['nagios']['user']
|
|
92
|
-
group node['nagios']['group']
|
|
93
|
-
mode '0755'
|
|
94
|
-
variables(
|
|
95
|
-
command_file: node['nagios']['conf']['command_file']
|
|
96
|
-
)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
nagios_bags = NagiosDataBags.new
|
|
100
|
-
pagerduty_contacts = nagios_bags.get('nagios_pagerduty')
|
|
101
|
-
|
|
102
|
-
nagios_command 'notify-service-by-pagerduty' do
|
|
103
|
-
options 'command_line' => ::File.join(node['nagios']['plugin_dir'], 'notify_pagerduty.pl') + ' enqueue -f pd_nagios_object=service -f pd_description="$HOSTNAME$ : $SERVICEDESC$"'
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
nagios_command 'notify-host-by-pagerduty' do
|
|
107
|
-
options 'command_line' => ::File.join(node['nagios']['plugin_dir'], 'notify_pagerduty.pl') + ' enqueue -f pd_nagios_object=host -f pd_description="$HOSTNAME$ : $SERVICEDESC$"'
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
unless node['nagios']['pagerduty']['key'].nil? || node['nagios']['pagerduty']['key'].empty?
|
|
111
|
-
nagios_contact 'pagerduty' do
|
|
112
|
-
options 'alias' => 'PagerDuty Pseudo-Contact',
|
|
113
|
-
'service_notification_period' => '24x7',
|
|
114
|
-
'host_notification_period' => '24x7',
|
|
115
|
-
'service_notification_options' => node['nagios']['pagerduty']['service_notification_options'],
|
|
116
|
-
'host_notification_options' => node['nagios']['pagerduty']['host_notification_options'],
|
|
117
|
-
'service_notification_commands' => 'notify-service-by-pagerduty',
|
|
118
|
-
'host_notification_commands' => 'notify-host-by-pagerduty',
|
|
119
|
-
'pager' => node['nagios']['pagerduty']['key']
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
pagerduty_contacts.each do |contact|
|
|
124
|
-
name = contact['contact'] || contact['id']
|
|
125
|
-
|
|
126
|
-
nagios_contact name do
|
|
127
|
-
options 'alias' => "PagerDuty Pseudo-Contact #{name}",
|
|
128
|
-
'service_notification_period' => contact['service_notification_period'] || '24x7',
|
|
129
|
-
'host_notification_period' => contact['host_notification_period'] || '24x7',
|
|
130
|
-
'service_notification_options' => contact['service_notification_options'] || 'w,u,c,r',
|
|
131
|
-
'host_notification_options' => contact['host_notification_options'] || 'd,r',
|
|
132
|
-
'service_notification_commands' => 'notify-service-by-pagerduty',
|
|
133
|
-
'host_notification_commands' => 'notify-host-by-pagerduty',
|
|
134
|
-
'pager' => contact['key'] || contact['pagerduty_key'],
|
|
135
|
-
'contactgroups' => contact['contactgroups']
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
cron 'Flush Pagerduty' do
|
|
140
|
-
user node['nagios']['user']
|
|
141
|
-
mailto 'root@localhost'
|
|
142
|
-
command "#{::File.join(node['nagios']['plugin_dir'], 'notify_pagerduty.pl')} flush"
|
|
143
|
-
end
|