Permalink
Browse files

some more refactoring

  • Loading branch information...
1 parent d46b44a commit 9b211dac5ef5ddbf1c98eee78d5a60e28f85100d @twissmueller committed Oct 4, 2012
View
BIN .DS_Store
Binary file not shown.
View
2 .gitignore
@@ -1,3 +1,5 @@
.vagrant
.swp
.DS_Store
+**/.DS_Store
+dev_ops_central.box
View
8 Vagrantfile
@@ -2,21 +2,21 @@ Vagrant::Config.run do |config|
config.ssh.private_key_path = File.expand_path("../dev_ops_central/id_rsa.vagrant")
config.vm.define :monitoring_server do |server|
- server.vm.box = "dev_ops_central_box"
+ server.vm.box = "dev_ops_central"
server.vm.host_name = "monitoring_server"
server.vm.network :hostonly, "192.168.10.10"
server.vm.provision :puppet do |puppet|
puppet.manifest_file = "site.pp"
puppet.module_path = File.expand_path("../modules", __FILE__)
- puppet.options = "--verbose --debug"
+ puppet.options = "--verbose"
end
server.vm.forward_port 55672, 55672 # needed for rabbitmq management frontend (guest/guest)
server.vm.forward_port 8080, 8080 # needed for sensu dashboard (admin/secret)
server.vm.forward_port 80, 9080 # needed for graphite webapp
end
config.vm.define :monitoring_client do |client|
- client.vm.box = "dev_ops_central_box"
+ client.vm.box = "dev_ops_central"
client.vm.host_name = "monitoring_client"
client.vm.network :hostonly, "192.168.10.20"
client.vm.provision :puppet do |puppet|
@@ -26,4 +26,4 @@ Vagrant::Config.run do |config|
end
end
-end
+end
View
BIN definitions/.DS_Store
Binary file not shown.
View
34 definitions/dev_ops_central/postinstall.sh
@@ -2,30 +2,42 @@
date > /etc/vagrant_box_build_time
-yum -y install gcc make gcc-c++ ruby kernel-devel-`uname -r` zlib-devel openssl-devel readline-devel sqlite-devel perl
-
-
cat > /etc/yum.repos.d/puppetlabs.repo << EOM
[puppetlabs]
name=puppetlabs
-baseurl=http://yum.puppetlabs.com/el/6/products/\$basearch
-enabled=1
+baseurl=http://yum.puppetlabs.com/el/6/products/x86_64/
gpgcheck=0
EOM
cat > /etc/yum.repos.d/epel.repo << EOM
[epel]
name=epel
-baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch
-enabled=1
+baseurl=http://download.fedoraproject.org/pub/epel/6/x86_64/
gpgcheck=0
EOM
-yum -y install puppet facter ruby-devel rubygems
-yum -y clean all
-rm /etc/yum.repos.d/{puppetlabs,epel}.repo
+yum -y install gcc make gcc-c++ ruby kernel-devel-`uname -r` zlib-devel openssl-devel readline-devel sqlite-devel perl puppet facter ruby-devel rubygems vim
+
+gem install --no-ri --no-rdoc chef hiera hiera-puppet hiera-json
+cat > /etc/puppet/hiera.yaml << EOM
+---
+ :logger: console
+ :backends:
+ - json
+ :hierarchy:
+ - default
+ :json:
+ :datadir: /etc/puppet/hieradb
+EOM
+
+mkdir /etc/puppet/hieradb
+cat > /etc/puppet/hieradb/default.json << EOM
+#{}
+EOM
-gem install --no-ri --no-rdoc chef
+# Cleaning up
+#yum -y clean all
+#rm /etc/yum.repos.d/{puppetlabs,epel}.repo
# Installing vagrant keys
mkdir /home/vagrant/.ssh
View
BIN iso/.DS_Store
Binary file not shown.
View
28 manifests/nodes.pp
@@ -1,20 +1,28 @@
-class role_monitoring_server {
+class monitoring_base {
+ include firewall
+ #include hiera
+}
+
+class role_monitoring_server inherits monitoring_base {
$my_role = 'monitoring_server'
- include ruby-devel
+
include rabbitmq
include redis
- include hiera
- include sensu::server
-
- Class['ruby-devel'] -> Class['hiera'] -> Class['sensu::server']
+
+ class {'sensu::server':
+ rabbitmq_server => '192.168.10.10'
+ }
}
-class role_monitoring_client {
+class role_monitoring_client inherits monitoring_base {
$my_role = 'monitoring_client'
+
include cron
- include ruby-devel
- include hiera
- include sensu::client
+
+ class {'sensu::client':
+ rabbitmq_server => '192.168.10.10',
+ sensu_client => '192.168.10.20',
+ }
}
node monitoring_server {
View
4 modules/cron/manifests/init.pp
@@ -1,13 +1,13 @@
class cron {
- info "Cron"
+ info "Provisioning Cron"
package{'crontabs':
ensure => 'present',
}
service{'crond':
- ensure => 'running',
+ ensure => 'stopped',
}
Package['crontabs'] -> Service['crond']
View
7 modules/firewall/manifests/init.pp
@@ -0,0 +1,7 @@
+class firewall {
+
+ service{"iptables":
+ ensure => "stopped"
+ }
+
+}
View
48 modules/hiera/manifests/init.pp
@@ -2,20 +2,20 @@
info "Provisioning Hiera"
- package{'hiera':
- ensure => 'present',
- provider => 'gem',
- }
-
- package{'hiera-puppet':
- ensure => 'present',
- provider => 'gem',
- }
-
- package{'hiera-json':
- ensure => 'present',
- provider => 'gem',
- }
+ #package{'hiera':
+ #ensure => 'present',
+ #provider => 'gem',
+ #}
+#
+ #package{'hiera-puppet':
+ #ensure => 'present',
+ #provider => 'gem',
+ #}
+#
+ #package{'hiera-json':
+ #ensure => 'present',
+ #provider => 'gem',
+ #}
file{'/etc/puppet/hiera.yaml':
ensure => present,
@@ -25,13 +25,13 @@
mode => '0644',
}
- file{'/etc/puppet/hieradb':
- ensure => directory,
- owner => 'root',
- group => 'root',
- mode => '0755',
- recurse => true
- }
+ #file{'/etc/puppet/hieradb':
+ #ensure => directory,
+ #owner => 'root',
+ #group => 'root',
+ #mode => '0755',
+ #recurse => true
+ #}
file{'/etc/puppet/hieradb/default.json':
ensure => present,
@@ -41,10 +41,10 @@
mode => '0644',
}
- Package['hiera'] -> Package['hiera-json'] -> Package['hiera-puppet']
+ #Package['hiera'] -> Package['hiera-json'] -> Package['hiera-puppet']
- Package['hiera-puppet'] -> File['/etc/puppet/hiera.yaml']
+ #Package['hiera-puppet'] -> File['/etc/puppet/hiera.yaml']
- File['/etc/puppet/hieradb'] -> File['/etc/puppet/hieradb/default.json']
+ #File['/etc/puppet/hieradb'] -> File['/etc/puppet/hieradb/default.json']
}
View
11 modules/rabbitmq/manifests/init.pp
@@ -1,17 +1,11 @@
class rabbitmq {
info "Provisioning RabbitMQ"
- $version = "2.7.1"
+ $version = "2.8.7"
$url = "http://www.rabbitmq.com/releases/rabbitmq-server/v${version}/rabbitmq-server-${version}-1.noarch.rpm"
- yumrepo{"epel-6.6":
- mirrorlist => 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6.6&arch=$basearch',
- gpgcheck => 0
- }
-
package{"erlang":
ensure => "present",
- require => Yumrepo["epel-6.6"]
}
package{"rabbitmq-server":
@@ -98,7 +92,4 @@
require => Exec['add-sensu-user'],
}
- service{"iptables":
- ensure => "stopped"
- }
}
View
2 modules/redis/manifests/init.pp
@@ -1,6 +1,6 @@
class redis {
- info "Redis"
+ info "Provisioning Redis"
package{'redis':
ensure => 'present',
View
10 modules/ruby-devel/manifests/init.pp
@@ -1,10 +0,0 @@
-class ruby-devel {
-
- info "Ruby-Devel"
-
- package{'ruby-devel':
- ensure => 'present',
- provider => 'yum',
- }
-
-}
View
3 modules/sensu/files/etc/sensu/conf.d/checks.json
@@ -4,20 +4,23 @@
"handlers": ["default"],
"command": "/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",
"interval": 60,
+ "standalone": true,
"subscribers": ["webservers"]
},
"http_metrics": {
"type": "metric",
"handlers": ["graphite"],
"command": "/etc/sensu/plugins/http-metrics.rb -h www.google.com -p 80 --scheme stats.:::name:::",
"interval": 60,
+ "standalone": true,
"subscribers": ["webservers"]
},
"cpu_metrics": {
"type": "metric",
"handlers": ["graphite"],
"command": "/etc/sensu/plugins/cpu-metrics.rb --scheme stats.:::name:::",
"interval": 60,
+ "standalone": true,
"subscribers": ["webservers"]
}
}
View
11 modules/sensu/manifests/client.pp
@@ -1,14 +1,19 @@
class sensu::client(
- $rabbitmq_server=hiera('rabbitmq_server'),
- $sensu_server=hiera('sensu_server'))
+ #$rabbitmq_server=hiera('rabbitmq_server'),
+ #$sensu_server=hiera('sensu_server'))
+ $rabbitmq_server,
+ $sensu_client)
{
info "Provisioning Sensu Client"
include sensu::common::package
include sensu::common::config
include sensu::client::package
- include sensu::client::config
+ class { "sensu::client::config":
+ rabbitmq_server => '192.168.10.10',
+ sensu_client => '192.168.10.20'
+ }
include sensu::client::service
Class['sensu::common::package'] -> Class['sensu::common::config'] -> Class['sensu::client::package'] -> Class['sensu::client::config'] -> Class['sensu::client::service']
View
22 modules/sensu/manifests/client/config.pp
@@ -1,4 +1,4 @@
-class sensu::client::config {
+class sensu::client::config($rabbitmq_server, $sensu_client) {
file{'/etc/sensu/conf.d/rabbitmq.json':
ensure => present,
@@ -10,7 +10,7 @@
file{'/etc/sensu/conf.d/client.json':
ensure => present,
- source => template('/vagrant/modules/sensu/templates/etc/sensu/conf.d/client.json',
+ content => template('/vagrant/modules/sensu/templates/etc/sensu/conf.d/client.json.erb'),
owner => 'root',
group => 'root',
mode => '0644',
@@ -35,16 +35,16 @@
file{'/etc/sensu/plugins/check-procs.rb':
ensure => present,
source => '/vagrant/modules/sensu/files/etc/sensu/plugins/check-procs.rb',
- owner => 'root',
- group => 'root',
+ owner => 'sensu',
+ group => 'sensu',
mode => '0744',
}
- #file{'/etc/sensu/plugins/cpu-metric.rb':
- #ensure => present,
- #source => '/vagrant/modules/sensu/files/etc/sensu/plugins/cpu-metric.rb',
- #owner => 'root',
- #group => 'root',
- #mode => '0644',
- #}
+ file{'/etc/sensu/plugins/cpu-metrics.rb':
+ ensure => present,
+ source => '/vagrant/modules/sensu/files/etc/sensu/plugins/cpu-metrics.rb',
+ owner => 'sensu',
+ group => 'sensu',
+ mode => '0744',
+ }
}
View
3 modules/sensu/manifests/common/package.pp
@@ -2,13 +2,14 @@
yumrepo{'sensu':
descr => 'sensu-main',
- baseurl => 'http://repos.sensuapp.org/yum/el/6/i386/',
+ baseurl => 'http://repos.sensuapp.org/yum/el/6/x86_64/',
gpgcheck => '0',
enabled => '1',
}
package{"sensu":
ensure => present,
+ provider => 'yum'
}
Yumrepo['sensu'] -> Package['sensu']
View
7 modules/sensu/manifests/server.pp
@@ -1,12 +1,15 @@
class sensu::server(
- $rabbitmq_server=hiera('rabbitmq_server'))
+ #$rabbitmq_server=hiera('rabbitmq_server'))
+ $rabbitmq_server)
{
info "Provisioning Sensu Server"
include sensu::common::package
include sensu::common::config
- include sensu::server::config
+ class {'sensu::server::config':
+ rabbitmq_server => '192.168.10.10'
+ }
include sensu::server::service
Class['sensu::common::package'] -> Class['sensu::common::config'] -> Class['sensu::server::config'] -> Class['sensu::server::service']
View
10 modules/sensu/manifests/server/config.pp
@@ -1,4 +1,4 @@
-class sensu::server::config {
+class sensu::server::config($rabbitmq_server) {
file{'/etc/sensu/conf.d/rabbitmq.json':
ensure => present,
@@ -24,6 +24,14 @@
mode => '0644',
}
+ file{'/etc/sensu/conf.d/checks.json':
+ ensure => absent,
+ source => '/vagrant/modules/sensu/files/etc/sensu/conf.d/checks.json',
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ }
+
file{'/etc/sensu/conf.d/dashboard.json':
ensure => present,
source => '/vagrant/modules/sensu/files/etc/sensu/conf.d/dashboard.json',
View
2 modules/sensu/templates/etc/sensu/conf.d/client.json.erb
@@ -1,7 +1,7 @@
{
"client": {
"name": "sensu-server.dom.tld",
- "address": "<%= sensu_server %>",
+ "address": "<%= sensu_client %>",
"subscriptions": [
"webservers"
]

0 comments on commit 9b211da

Please sign in to comment.