[[PageOutline(2-5,Contents,pullout)]] = Orchestrates AWS cloud resources using boto and pychef = == '''WARNING! This plugin is in alpha.''' == I recommend you ''not'' use this plugin yet on production instances. Although you likely won't lose ec2 instances or chef data, it's still quite immature. It would be best to try out on dev instances to help test the plugin and generate ideas for new features. - robguttman, 2011 Jan 28 == Description == This plugin is meant to fill the coordination gap between AWS and Chef, especially: * Launch an ec2 instance and apply one or more chef roles * Terminate ec2 instances and delete its chef node Screenshot: [[Image(instance-grid.png)]] There are additional features and quite possibly more to come, but my intention is to keep the scope down to what's needed to orchestrate between AWS and Chef (and not re-implement either the AWS Management Console or the Chef Server webui). This plugin relies heavily upon [http://boto.cloudhackers.com/ boto] and [https://github.com/coderanger/pychef pychef]. Special thanks to coderanger for his responsiveness on pychef. == Configuration == 1. Install the plugin (after downloading and unzipping): {{{ cd cloudplugin/0.12 sudo python setup.py bdist_egg sudo cp dist/TracCloud*.egg /your/trac/location/plugins/ }}} See [http://trac.edgewall.org/wiki/TracPlugins TracPlugins] for more installation details and options. You'll likely need to restart Trac's web server after installation. 2. Enable the plugin in {{{trac.ini}}}: {{{ [components] cloud.* = enabled }}} You can alternatively use the Trac Web Admin GUI to enable any or all rules. 3. Configure the main {{{trac.ini}}} section: {{{ [cloud] label = Cloud aws_key = aws_secret = aws_keypair = chef_instancedata_file = /path/to/instance-data.json }}} The {{{label}}} option above is the name to be used in the top navigation: [[Image(nav.png)]] === AWS credentials === The {{{aws_*}}} options are your AWS credentials and the key pair used by your ec2 instances. === Chef configuration === The {{{chef_instancedata_file}}} option is the absolute path to the ec2 instance/user data generated by chef's knife command: {{{ % knife ec2 instance data role[] > /path/to/instance-data.json }}} The plugin will use this file for the instance data replacing the role information as needed. As the file contains the {{{validation.pem}}} data, be sure to secure it accordingly. In cases where you need different credentials and/or chefserver url, you can use the following option to specify a base directory which must contain the typical {{{.chef}}} directory and its contents plus (optionally) a {{{validation.pem}}} file within the {{{.chef}}} directory: {{{ [cloud] .. chef_base_path = /path/to/dir/that/contains/.chef }}} It's currently assumed that you're using one of Opscode's AMIs or a homegrown AMI derived from it. These AMIs use the instance's id as the node name. However, you may have recipes which for one reason or another change the node's name after the first chef-client run. If so, you need to specify the boto field that maps to the final node name using this config option: {{{ [cloud] .. boto_field_node_name = private_dns_name }}} Adding this option will cause the plugin to create a new node of that name upon launching a new ec2 instance and once it checks in will remove the original node. Otherwise you'll have two chef nodes for the same ec2 instance - something you likely don't want. Yeah, this is a bit complicated - an area ripe for improvement. The plugin is intended to support multiple AWS resource types in addition to instances as needed for orchestration with chef. You specify the default resource to view using this config option: {{{ [cloud] .. default_resource = instance }}} Each AWS resource type such as {{{instance}}} above is configured independently. See the examples section [wiki:CloudPlugin#Examples below] for how to specify these resources. == Bugs/Feature Requests == Existing bugs and feature requests for CloudPlugin are [report:9?COMPONENT=CloudPlugin here]. If you have any issues, create a [http://trac-hacks.org/newticket?component=CloudPlugin&owner=robguttman new ticket]. == Download == Download the zipped source from [download:cloudplugin here]. == Source == You can check out CloudPlugin from [http://trac-hacks.org/svn/cloudplugin here] using Subversion, or [source:cloudplugin browse the source] with Trac. == Example == trac.ini config ... [cloud] ... == Recent Changes == [[ChangeLog(cloudplugin, 3)]] == Author/Contributors == '''Author:''' [wiki:robguttman] [[BR]] '''Maintainer:''' [wiki:robguttman] [[BR]] '''Contributors:'''