mcollective introduction
TRANSCRIPT
Infrastructure Coders
Mcollective: An introduction to the marionette.
Melbourne 06-06-2012
Javier Turgano
@setoide
#devops#opensource#it-management
DisclaimerNot mcollective Ninja
Why do we need orchestration?
BalancerWebappBdd
WebappWebapp
Example architecture
Provisionnew nodeApply configas webserverGrant accessto DBUse case: Add one webapp server
DeployLast versionOf AppAdd to LoadBalancerActivatemonitoringStartwebserverIn Prod!
UpdateDb schema(addings)Provision 1New appserverTestUse case: Deploy new version
Send trafficUpdateDb schema(removals)In Prod!ReplaceApp servers
Some options available
FuncFabricCapistranomcollective
Marionete Colective
mcollective is a framework to build server orchestration or parallel job execution systems
Created by R.I. Pienaar
Is it better than an SSH loop?
Asynchronous/Event drivenScalableRIP Hostnames use facts, classes.Modular (security, middleware, agents)Auto discoveryDe-centralized inventory
Architecture
Install middleware
# apt-get install rabbitmq# rabbitmqctl add_user mcollective marionette# rabbitmqctl set_user_tags mcollective \ administrator# rabbitmqctl set_permissions -p / mcollective \".*" ".*" ".*"
Install mcollective
In your servers:
# sudo apt-get install mcollective
In your admnistrator's machines:
# sudo apt-get install mcollective-client
Configure mcollective
topicprefix = /topic/main_collective = mcollectivecollectives = mcollectivelibdir = /usr/share/mcollective/pluginslogfile = /var/log/mcollective.logloglevel = infodaemonize = 0
# Pluginssecurityprovider = pskplugin.psk = unset
connector = stompplugin.stomp.host= masterplugin.stomp.port= 6163plugin.stomp.user= mcollectiveplugin.stomp.password= marionette
# Factsfactsource = facter
Advanced config
Some interesting options:
loglevel=debug
#factsource = facterfactsource = yamlplugin.yaml = /etc/mcollective/facts.yaml
classesfile = /var/lib/puppet/state/classes.txt
Puppet modules
Puppet modules available.
For RHEL:
puppetlabs/rabbitmqpuppetlabs/mcollective
DEMO TIME!
Finding nodes
Targeting nodes using facts and classes:
# mc-ping
# mc-find-hosts -F virtual=virtualbox# mc-find-hosts -F memoryfree>100M# mc-find-hosts -C mcollective -F operatingsystem="Ubuntu"
Inventory
Powerful distributed inventory system:
# mc-facts virtual# mc-facts processorcount
# mc-inventory box01
Plugins
You can get plugins from:http://projects.puppetlabs.com/projects/mcollective-plugins/wiki
Facts-facterFilemgrIptablesPackageProcessPuppetdService
Using the filemgr plugin
# mco rpc filemgr status file=/tmp/filemgr
Using the iptables plugin
# mco iptables block 192.168.0.0 -C base -v
Node01 # iptables -L -n -v
Using the package plugin
# mco package status vim-puppet -C base -v
# mco package uninstall vim-puppet -C base -v
Executing puppet
# mco puppetd status -C base
Edit puppet base class
# mco puppetd runonce 1 -v -C base
Check output in /var/log/syslog
RIPHosnames
QUESTIONS?
Images
http://www.flickr.com/photos/ag2r/3783369226/
http://www.flickr.com/photos/31348155@N03/5584078173/
http://www.flickr.com/photos/61927538@N00/205992050/
http://www.flickr.com/photos/safari_vacation/5842069535