[bootstrap] Add MCollective to master-node. Minor fixes.
This commit is contained in:
parent
5309cd04ed
commit
af23627ec2
|
@ -12,6 +12,7 @@
|
|||
/.vagrant
|
||||
|
||||
/build
|
||||
/mirror
|
||||
nosetests.xml
|
||||
nailgun.log
|
||||
lock
|
||||
|
|
|
@ -2,3 +2,6 @@
|
|||
masternode_ip=`sed -r 's/^.*url=http:\/\/([^/]+)\/.*$/\1/' /proc/cmdline`
|
||||
sed -i "s/plugin.stomp.host= .*\$/plugin.stomp.host= $masternode_ip/" /etc/mcollective/server.cfg
|
||||
service mcollective restart
|
||||
|
||||
sed -r 's/^.*BOOTIF=([^ ]+).*$/\1/' /proc/cmdline|tr -d '-\n'|tail -c12 >/etc/bootif
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require "json"
|
||||
|
||||
module MCollective
|
||||
module Agent
|
||||
require "json"
|
||||
class Net_probe<RPC::Agent
|
||||
metadata :name => "Network Probe Agent",
|
||||
:description => "Check network connectivity between nodes.",
|
||||
|
@ -10,7 +11,10 @@ module MCollective
|
|||
:url => "http://mirantis.com",
|
||||
:timeout => 60
|
||||
|
||||
uid = "5e33c330-fce0-11e1-a21f-0800200c9a66"
|
||||
uid = ""
|
||||
open('/etc/bootif') do |f|
|
||||
uid = f.gets
|
||||
end
|
||||
|
||||
action "start_frame_listeners" do
|
||||
validate :iflist, String
|
||||
|
@ -56,7 +60,18 @@ module MCollective
|
|||
piddir = "/var/run/net_probe"
|
||||
pidfiles = Dir.glob(File.join(piddir, '*'))
|
||||
pidfiles.each do |f|
|
||||
run("kill -INT #{File.basename(f)}")
|
||||
#run("kill -INT #{File.basename(f)}")
|
||||
Process.kill("INT", File.basename(f))
|
||||
end
|
||||
while not pidfiles.empty? do
|
||||
pidfiles.each do |f|
|
||||
begin
|
||||
Process.getpgid(File.basename(f))
|
||||
File.unlink(f)
|
||||
rescue Errno::ESRCH, Errno::ENOENT
|
||||
end
|
||||
end
|
||||
pidfiles = Dir.glob(File.join(piddir, '*'))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -76,7 +91,6 @@ module MCollective
|
|||
|
||||
def get_probing_frames()
|
||||
stop_frame_listeners
|
||||
sleep(1)
|
||||
neigbours = Hash.new
|
||||
pattern = "/var/tmp/net-probe-dump-*"
|
||||
Dir.glob(pattern).each do |file|
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
= DESCRIPTION:
|
||||
|
||||
Installs the Marionette Collective
|
||||
|
||||
= PLATFORMS:
|
||||
|
||||
Tested as working:
|
||||
* Ubuntu (10.04)
|
||||
* Centos (5.5, 5.6, 6.0)
|
||||
|
||||
Likely to work without modification on Debian, RHEL, Fedora (if you try, please let me know).
|
||||
|
||||
|
||||
= REQUIREMENTS:
|
||||
|
||||
A STOMP server.
|
||||
|
||||
Cookbooks
|
||||
---------
|
||||
* apt
|
||||
* yum
|
||||
* chef_handler
|
||||
|
||||
The `apt_repository` and `yum_repository` LWRPs are optionally used to create entries for the puppetlabs repository.
|
||||
The `chef_handler` LWRP is used to install a report handler (::server only)
|
||||
|
||||
|
||||
= ATTRIBUTES:
|
||||
|
||||
Security:
|
||||
* mcollective['psk'] - the pre-shared key for encrypting messages
|
||||
|
||||
STOMP service connection details:
|
||||
* mcollective['stomp']['hostname']
|
||||
* mcollective['stomp']['port']
|
||||
* mcollective['stomp']['username']
|
||||
* mcollective['stomp']['password']
|
||||
|
||||
Site Plugin path:
|
||||
* mcollective['site_plugins'] - installation location for extra plugins (this is added to the MCollective plugin path)
|
||||
|
||||
Facts:
|
||||
* mcollective['factsource'] - sets where MCollective gets facts from
|
||||
* mcollective['fact_whitelist'] - Ohai fact groups to include when using the 'yaml' factsource.
|
||||
|
||||
|
||||
= USAGE:
|
||||
|
||||
Add recipe[mcollective] to your run_list to install the server and client tools.
|
||||
|
||||
Set the node's mcollective['stomp'] attributes to point to your server (or use role/environment attributes). The default expects a STOMP server on localhost configured as per http://docs.puppetlabs.com/mcollective/reference/basic/gettingstarted.html#configuring-stomp
|
||||
|
||||
MCollective's "class list" will be populated with the roles and recipes present in the expanded run list of the last Chef run.
|
||||
|
||||
You can customise installation by choosing from these recipes instead of the default:
|
||||
* recipe[mcollective::server] installs the server components.
|
||||
* recipe[mcollective::client] installs the client components.
|
||||
* recipe[mcollective::puppetlabs-repo] installs the Puppetlabs apt/yum repo.
|
||||
|
||||
|
||||
= TODO:
|
||||
|
||||
* Support for security configurations other than PSK
|
||||
* Configurable fact- and class-file names.
|
||||
* Tests
|
||||
|
||||
= LICENSE:
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,50 @@
|
|||
#
|
||||
# Cookbook Name:: mcollective
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright 2011, Zachary Stevens
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# version of mcollective to install
|
||||
default['mcollective']['package']['version'] = nil
|
||||
|
||||
# pre-shared key
|
||||
default['mcollective']['psk'] = "unset"
|
||||
|
||||
# STOMP server details
|
||||
default['mcollective']['stomp']['hostname'] = "localhost"
|
||||
default['mcollective']['stomp']['port'] = "6163"
|
||||
default['mcollective']['stomp']['username'] = "mcollective"
|
||||
default['mcollective']['stomp']['password'] = "marionette"
|
||||
|
||||
default['mcollective']['site_plugins'] = "/etc/mcollective/site_plugins/mcollective"
|
||||
|
||||
# Fact Source
|
||||
# The default option configures MCollective to read a YAML file
|
||||
# produced by a Chef handler, containing a configurable list of
|
||||
# facts. This gives the best MCollective performance, at the cost of
|
||||
# less fresh data (updated only as frequently as you run Chef).
|
||||
#
|
||||
# Set this to 'ohai' to instead use the opscodeohai MCollective Fact
|
||||
# plugin.
|
||||
default['mcollective']['factsource'] = 'yaml'
|
||||
|
||||
# MCollective plugin location (created by the packages)
|
||||
case platform
|
||||
when "debian","ubuntu"
|
||||
default['mcollective']['libdir'] = "/usr/share/mcollective/plugins"
|
||||
when "redhat","centos","fedora"
|
||||
default['mcollective']['libdir'] = "/usr/libexec/mcollective"
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
maintainer "Zachary Stevens"
|
||||
maintainer_email "zts@cryptocracy.com"
|
||||
license "Apache v2.0"
|
||||
description "Installs/Configures mcollective"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
|
||||
version "0.10.0"
|
||||
|
||||
%w{ debian ubuntu redhat centos fedora scientific}.each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
depends "chef_handler", ">= 1.0.4"
|
||||
depends "apt"
|
||||
depends "yum"
|
||||
|
||||
recipe "mcollective::default", "Installs and configures mcollective client and server, using the Puppetlabs package repository."
|
||||
|
||||
recipe "mcollective::server", "Installs and configures mcollective server."
|
||||
recipe "mcollective::client", "Installs and configures mcollective client tools."
|
|
@ -0,0 +1,33 @@
|
|||
#
|
||||
# Cookbook Name:: mcollective
|
||||
# Recipe:: client
|
||||
#
|
||||
# Copyright 2011, Zachary Stevens
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include_recipe "mcollective::common"
|
||||
|
||||
package "mcollective-client" do
|
||||
action :install
|
||||
end
|
||||
|
||||
# The libdir paths in the MC configuration need to omit the
|
||||
# trailing "/mcollective"
|
||||
site_libdir = node['mcollective']['site_plugins'].sub(/\/mcollective$/, '')
|
||||
|
||||
template "/etc/mcollective/client.cfg" do
|
||||
source "client.cfg.erb"
|
||||
mode 0644
|
||||
variables :site_plugins => site_libdir
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
#
|
||||
# Cookbook Name:: mcollective
|
||||
# Recipe:: common
|
||||
#
|
||||
# Resources required by both client and server.
|
||||
#
|
||||
# Copyright 2011, Zachary Stevens
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
package "rubygems" do
|
||||
action :install
|
||||
end
|
||||
|
||||
package "rubygem-stomp" do
|
||||
case node['platform']
|
||||
when "ubuntu","debian"
|
||||
package_name "libstomp-ruby"
|
||||
when "centos","redhat","fedora"
|
||||
package_name "rubygem-stomp"
|
||||
end
|
||||
action :install
|
||||
end
|
||||
|
||||
package "mcollective-common" do
|
||||
action :install
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
#
|
||||
# Cookbook Name:: mcollective
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2011, Zachary Stevens
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include_recipe "mcollective::server"
|
||||
include_recipe "mcollective::client"
|
|
@ -0,0 +1,39 @@
|
|||
#
|
||||
# Cookbook Name:: mcollective
|
||||
# Recipe:: server
|
||||
#
|
||||
# Copyright 2011, Zachary Stevens
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include_recipe "mcollective::common"
|
||||
|
||||
package "mcollective" do
|
||||
action :install
|
||||
version node['mcollective']['package']['version']
|
||||
end
|
||||
|
||||
service "mcollective" do
|
||||
supports :restart => true, :status => true
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
||||
# The libdir paths in the MC configuration need to omit the
|
||||
# trailing "/mcollective"
|
||||
site_libdir = node['mcollective']['site_plugins'].sub(/\/mcollective$/, '')
|
||||
template "/etc/mcollective/server.cfg" do
|
||||
source "server.cfg.erb"
|
||||
mode 0600
|
||||
notifies :restart, 'service[mcollective]'
|
||||
variables :site_plugins => site_libdir
|
||||
end
|
|
@ -0,0 +1,25 @@
|
|||
topicprefix = /topic/
|
||||
main_collective = mcollective
|
||||
collectives = mcollective
|
||||
libdir = <%= @site_plugins %>:<%= @node['mcollective']['libdir'] %>
|
||||
logfile = /dev/null
|
||||
loglevel = info
|
||||
|
||||
# Plugins
|
||||
securityprovider = psk
|
||||
plugin.psk = <%= @node['mcollective']['psk'] %>
|
||||
|
||||
connector = stomp
|
||||
plugin.stomp.host = <%= @node['mcollective']['stomp']['hostname'] %>
|
||||
plugin.stomp.port = <%= @node['mcollective']['stomp']['port'] %>
|
||||
plugin.stomp.user = <%= @node['mcollective']['stomp']['username'] %>
|
||||
plugin.stomp.password = <%= @node['mcollective']['stomp']['password'] %>
|
||||
|
||||
# Facts
|
||||
<% if @node['mcollective']['factsource'] == 'ohai' %>
|
||||
factsource = opscodeohai
|
||||
fact_cache_time = 300
|
||||
<% else %>
|
||||
factsource = yaml
|
||||
plugin.yaml = /etc/mcollective/facts.yaml
|
||||
<% end %>
|
|
@ -0,0 +1,30 @@
|
|||
topicprefix = /topic/
|
||||
main_collective = mcollective
|
||||
collectives = mcollective
|
||||
identity = <%= @node['fqdn'] %>
|
||||
libdir = <%= @site_plugins %>:<%= @node['mcollective']['libdir'] %>
|
||||
logfile = /var/log/mcollective.log
|
||||
loglevel = info
|
||||
daemonize = 1
|
||||
|
||||
# Plugins
|
||||
securityprovider = psk
|
||||
plugin.psk = <%= @node['mcollective']['psk'] %>
|
||||
|
||||
connector = stomp
|
||||
plugin.stomp.host = <%= @node['mcollective']['stomp']['hostname'] %>
|
||||
plugin.stomp.port = <%= @node['mcollective']['stomp']['port'] %>
|
||||
plugin.stomp.user = <%= @node['mcollective']['stomp']['username'] %>
|
||||
plugin.stomp.password = <%= @node['mcollective']['stomp']['password'] %>
|
||||
|
||||
# Facts
|
||||
<% if @node['mcollective']['factsource'] == 'ohai' %>
|
||||
factsource = opscodeohai
|
||||
fact_cache_time = 300
|
||||
<% else %>
|
||||
factsource = yaml
|
||||
plugin.yaml = /etc/mcollective/facts.yaml
|
||||
<% end %>
|
||||
|
||||
# Classes
|
||||
classesfile = /var/tmp/chefnode.txt
|
|
@ -1,5 +1,6 @@
|
|||
include_recipe "python"
|
||||
include_recipe "rabbitmq"
|
||||
include_recipe "mcollective"
|
||||
|
||||
['libxml2-dev', 'python-dev', 'python-paramiko', 'ruby-httpclient'].each do |deb|
|
||||
package deb do
|
||||
|
|
|
@ -38,3 +38,13 @@ end
|
|||
service "rabbitmq-server" do
|
||||
action [ :start ]
|
||||
end
|
||||
|
||||
rabbitmq_user "mcollective" do
|
||||
password "marionette"
|
||||
action :add
|
||||
end
|
||||
|
||||
rabbitmq_user "mcollective" do
|
||||
permissions "\".*\" \".*\" \".*\""
|
||||
action :set_permissions
|
||||
end
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
Paste==1.7.5.1
|
||||
SQLAlchemy==0.7.8
|
||||
amqplib==1.0.2
|
||||
anyjson==0.3.3
|
||||
coverage==3.5.2
|
||||
distribute==0.6.24
|
||||
eventlet==0.9.17
|
||||
greenlet==0.4.0
|
||||
netaddr==0.7.10
|
||||
kombu==2.4.5
|
||||
paramiko==1.7.7.2
|
||||
web.py==0.37
|
||||
mock==1.0b1
|
||||
nose==1.1.2
|
||||
coverage==3.5.2
|
|
@ -11,8 +11,10 @@ libapache2-mod-wsgi
|
|||
libapache2-svn
|
||||
libhttpclient-ruby
|
||||
libjson-ruby
|
||||
libstomp-ruby
|
||||
libxml2-dev
|
||||
mcollective
|
||||
mcollective-client
|
||||
ntp
|
||||
ohai
|
||||
python-dev
|
||||
|
|
Loading…
Reference in New Issue