Created
March 22, 2011 04:08
-
-
Save tbatchelli/880762 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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