{"id":1129,"date":"2009-11-06T18:55:04","date_gmt":"2009-11-06T17:55:04","guid":{"rendered":"http:\/\/www.devco.net\/?p=1129"},"modified":"2010-08-17T12:34:31","modified_gmt":"2010-08-17T11:34:31","slug":"test_driven_deployment_-_mcollective_puppet_cucumber","status":"publish","type":"post","link":"https:\/\/www.devco.net\/archives\/2009\/11\/06\/test_driven_deployment_-_mcollective_puppet_cucumber.php","title":{"rendered":"Test Driven Deployment – mcollective, puppet, cucumber"},"content":{"rendered":"

With the release of mcollective<\/a> recently I’ve been able to work a bit on a deploy problem I’ve had at a client, I was able to build up the following by combining mcollective<\/a>, cucumber<\/a> and the open source mcollective plugins<\/a>.<\/p>\n

The cucumber exploring is of course a result of @auxesis<\/a>‘s brilliant cucumber talk at Devops Days recently.<\/p>\n

Note:<\/b> I’ve updated this from the initial posting, showing how I do filtering with mcollective discovery and put it all into one scenario.<\/p>\n

\n
\r\nFeature: Update the production systems\r\n\r\n    Background:\r\n        Given the load balancer has ip address 192.168.1.1\r\n        And I want to update hosts with class roles::dev_server\r\n        And I want to update hosts with fact country=de \r\n        And I want to pre-discover how many hosts to update\r\n       \r\n    Scenario: Update the website\r\n        When I block the load balancer\r\n        Then traffic from the load balancer should be blocked\r\n\r\n        When I update the package mywebapp\r\n        Then the package version for mywebapp should be 4.2.6-3.el5\r\n\r\n        When I unblock the load balancer\r\n        Then traffic from the load balancer should be unblocked<\/pre>\n<\/blockquote>\n

This is completely like any other test driven scenario based system, if it fails to block the firewall deploy will bail out. If it fails to update the package it will bail and finally only if those worked will it unblock the firewall. <\/p>\n

Thanks to mcollective this is distributed and parallel over large numbers of machines. I can also apply filters to update just certain clusters using mcollective’s discovery features.<\/p>\n

Everything’s outcome is tested and cucumber will only show the all clear when everything worked on all machines in a consistent way.<\/p>\n

This is made possible in part because the mcollective plugins use the Puppet providers underneath the hood, so package and service actions are complete idempotent and repeatable, I can rerun this script 100 times and it will do the same thing.<\/p>\n

I have other steps not included here to keep things simple but in a real world I would restart the webserver after the update and I would then call NRPE plugins on all the nodes to make sure their load average is in acceptable ranges before the firewall gets opened letting the load balancer in.<\/p>\n

This opens up a whole lot of interesting ideas, kudos to @auxesis<\/a> and his great talk at devopsdays!<\/p>\n","protected":false},"excerpt":{"rendered":"

With the release of mcollective recently I’ve been able to work a bit on a deploy problem I’ve had at a client, I was able to build up the following by combining mcollective, cucumber and the open source mcollective plugins. The cucumber exploring is of course a result of @auxesis‘s brilliant cucumber talk at Devops […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","footnotes":""},"categories":[7],"tags":[121,79,78,21,13],"_links":{"self":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/1129"}],"collection":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/comments?post=1129"}],"version-history":[{"count":12,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/1129\/revisions"}],"predecessor-version":[{"id":1722,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/1129\/revisions\/1722"}],"wp:attachment":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/media?parent=1129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/categories?post=1129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/tags?post=1129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}