Saturday, March 31, 2012

AWS Cloudformation with mcollective

http://www.devco.net/archives/2011/02/26/mcollective_101_demo_using_aws_cloudformation.php
http://docs.puppetlabs.com/mcollective/ec2demo.html

  • Create security group ("mcollective") with following ports open
    • 22, 6163, 80
  • Launch new EC2 instance in eu-west-1a
    • Search community images for "mcollective" choose only result (mcollective-120)
    • Add user values of 
      • mcollective=server
      • role=server
  • Login as root
  • start-mcollective-demo.rb 
    • Copy the following block of text output:
      • mcollective=10.249.58.63
        mcollective_password=Zpvungei
        mcollective_psk=Ungiemej
  • mc-ping
  • Launch 5 more ec2 instances in eu-west-1a by right-clicking existing image and "Launch more like this"
    • Number of instances = 5
    • Paste the block of text copied above into the "User Data" field
  •  Do the same again (another 5 servers) in eu-west-1b
  • Back to main server console
    • mc-ping --timeout 1   # should see all 11 servers
    • facter | grep ec2
    • mc-facts --timeout 1 ec2_placement_availability_zone
      • Report for fact: ec2_placement_availability_zone

                eu-west-1a                              found 6 times
                eu-west-1b                              found 5 times

        Finished processing 11 / 11 hosts in 580.78 ms
    • mc-package --with-fact ec2_placement_availability_zone=eu-west-1a status httpd
    • mc-package --with-fact ec2_placement_availability_zone=eu-west-1a install httpd
    • mc-service httpd status
    • mc-service --with-fact ec2_placement_availability_zone=eu-west-1a httpd start
    • (You'd use Puppet to deploy the app, but upgrade packages using mcollective)
    •  mc-nrpe check_load
    • mc-package --with-fact ec2_placement_availability_zone=eu-west-1b install httpd
    • mc-service --with-fact ec2_placement_availability_zone=eu-west-1b httpd restart
    • mc-service httpd status
    • facter
    • (Can provide your own data/plugins)


Old instructions:
http://blip.tv/the-marionette-collective/mcollective-aws-cloudformation-demo-4837780

http://puppetlabs.com/mcollective/introduction/
http://projects.puppetlabs.com/projects/mcollective-plugins/wiki/AgentService
http://projects.puppetlabs.com/projects/mcollective-plugins/wiki/AgentPackage

  • facter
  • mc-ping
  • mc-inventory ip-10-239-131-241
  • mc-facts ec2_ami_manifest_path
  • mc-inventory ip-10-239-131-241 | grep ec2
  • mc-facts ec2_placement_availability_zone
  • mc-facts cluster
  • mc-facts cluster -v
  • mc-find-hosts -W cluster=alfa
  • mco service httpd status
  • mco service -W cluster=alfa httpd status
  • mco package install httpd
  • mco service httpd restart
  • mc-urltest http://digg.com