Skip to content

Instantly share code, notes, and snippets.

@tbatchelli
Created May 8, 2013 23:24
Show Gist options
  • Save tbatchelli/5544439 to your computer and use it in GitHub Desktop.
Save tbatchelli/5544439 to your computer and use it in GitHub Desktop.
(learn-pallet/bootstrap-ns multi-node nil)
(ns multi-node
(:require [pallet.crate :as crate]
[pallet.core.session :as session]))
(def group-a
(group-spec
"group-a"
:extends *base-spec*
:phases
{:store-ip (plan-fn
(crate/assoc-settings :my-ip {:ip-address (target-ip (session/session))}))}))
(def group-b
(group-spec
"group-b"
:extends *base-spec*
:phases
{:write-ips (plan-fn
(let [ips (vec (crate/nodes-in-group "group-a"))]
(remote-file "group-a-ips.txt" :content ips)))}))
(defn run
([] (run 2))
([n]
(converge {group-a n group-b 1} :compute *compute*
:phase [:store-ip :write-ips])))
(defn destroy []
(converge {group-a 0 group-b 0} :compute *compute*))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment