Skip to content

Instantly share code, notes, and snippets.

@tbatchelli
Created March 22, 2011 04:08
Show Gist options
  • Save tbatchelli/880762 to your computer and use it in GitHub Desktop.
Save tbatchelli/880762 to your computer and use it in GitHub Desktop.
(ns example.core
(:use [pallet.core :only (defnode converge lift)]
[pallet.resource :only (phase)]
[pallet.compute :as compute]
[pallet.resource.remote-file :as remote-file]
[pallet.crate.automated-admin-user :only (automated-admin-user)]
clojure.pprint)
(:require [pallet.parameter :as parameter]
[pallet.resource :as resource]))
;; first define an image template. For convenience
(def ubuntu {:os-family :ubuntu
:os-64-bit true})
;; then setup a connection with the cloud provider
(def service (compute/compute-service-from-config-file :virtualbox))
;; define a node, without any phases.
(defnode x ubuntu)
;; instantiate a node of this type via the provider
(converge {x 1} :compute service)
;; instantiate 4 nodes will create 3 more (we already had one
(converge {x 4} :compute service)
;; destroy all nodes.
(converge {x 0} :compute service)
;; let's define a phase and give it a test
(defnode x ubuntu
:bootstrap automated-admin-user)
(converge {x 1} :compute service)
;; now let's add a new phase, this time a configure one.
(defnode x ubuntu
:bootstrap automated-admin-user
:configure (phase
(remote-file/remote-file )))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment