satis egitimisatis egitimitengda.pro

Open@Blog

Discussion on the state of cloud computing and open source software that helps build, manage, and deliver everything-as-a-service.

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that has been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.
  • Login
Posted by on in CloudStack Tips
  • Font size: Larger Smaller
  • Hits: 8095
  • Print
  • Report this post

HOWTO: Using CloudStack resources with Puppet, part 1

I've written a bit about the CloudStack resources written by Dan Bode and how awesome they are. And while cheerleading and telling people it is awesome should be enough - it doesn't really tell you how to actually use it. I will try and remedy that in the next few posts.

CloudStack Resources

Grab the resources from here: https://github.com/bodepd/cloudstack_resources Copy that into your modules directory in your puppet repository.

FOG

You need to ensure that you have fog installed. And by installed, I mean on the machine that will be talking with CloudStack. In our example we'll be using the puppetmaster machine. In an enlightened distribution like Fedora you can install by:
yum install rubygem-fog
In less englightened distributions you can use:
gem install fog

Configuration

You'll need to add a transport.yaml file to /etc/puppet Exercise caution with this file, it will contain API credentials Mine looks similar to:
cloudstack: api_key: 'WgOdxLuGFA2h2g-Ln2Hg9yWwEN1D3W4aqdXNXKTt_4xIOu234sdfs32NfDRM43JK3j1szDJzZf6CIgNAA' secret_access_key: 'S9Bd2JnuKComulSaqqyaudfwsdfsfesnM6ss7aydWof9QUT9zQ9Jhtja1GhbKcjrquSv7eV11ZpL9bybHxS0xg' host: 'cloud.cloudstack.org' port: '8080' path: '/client/api' scheme: 'https'

Defining some infrastructure

We'll set up a simple class with a single machine defined, and install as it: modules/infra/manifests/init.pp
class infra { cloudstack_instance { 'foo': ensure => present, flavor => 'Small Instance', zone => 'SanJose', image => 'CentOS63KVMPW', group => 'role=db', } }

Applying the class

Now that we have a class defined it's time for us to apply that - I am going to assume that you have a site.pp - if you don't, I figure you must be using something like and ENC and are smart enough to figure out how to apply the infra class. in site.pp you likely some lines like:
node 'puppetserver.cloudy.loc' { include puppet::master }
You want that to look like:
node 'puppetserver.cloudy.loc' { include puppet::master include infra }
The next time that puppet runs on the puppetmaster you should see log messages that say: Notice: /Stage[main]//Cloudstack_instance[foo]/ensure: created This has us using Puppet to define our infrastructure. In the next part we'll hook up puppet to reading CloudStack metadata.
Rate this blog entry:
Trackback URL for this blog entry.
David Nalley is currently employed by Citrix as the Community Manager for the CloudStack project. In addition he's a long time contributor to the Fedora Project, where among other things he is currently serving on the Fedora Project Board. He's also contributed to in various forms to Cobbler, Zenoss, Opengroupware.org, OLPC Math4, and Sahana. He is a frequent speaker at Free Software conferences around the nation, and writes for a number of technical and open source media publications including Linux Pro Magazine and OpenSource.com
  • No comments made yet. Be the first to submit a comment

Leave your comment

Guest Wednesday, 23 July 2014

Open@Citrix

Citrix supports the open source community via developer support and evangeslism. We have a number of developers and evangelists that participate actively in the open source community in Apache Cloudstack, OpenDaylight, Xen Project and XenServer. We also conduct educational activities via the Build A Cloud events held all over the world. 

Connect