include "../service/service.sfp" include "../aptpackage/aptpackage.sfp" /** * Module for managing Hadoop version 1 * * - password can be generated using command: * $ echo "mypassword" | makepasswd --clearfrom=- --crypt-md5 |awk '{ print $2 }' * */ schema Hadoop1 { installed = true running = true final home = "/opt/hadoop" final user = "hadoop" final group = "hadoop" final password = "!" final source = "http://www.mirrorservice.org/sites/ftp.apache.org/hadoop/common" final version = "1.2.1" final java_home = "" final data_dir = "/opt/hadoop/data" final replication = 2 java isa AptPackage { package_name = "default-jre" } sub install { condition { this.installed != true this.java.installed = true } effect { this.installed = true } } sub uninstall { condition { this.installed = true this.running = false } effect { this.installed = false } } sub start { condition { this.installed = true this.running != true } effect { this.running = true } } sub stop { condition { this.installed = true this.running = true } effect { this.running = false } } } schema Hadoop1Master extends Hadoop1 { home = "/opt/hadoopmaster" data_dir = "/opt/hadoopmaster/data" } schema Hadoop1Slave extends Hadoop1 { master isref Hadoop1Master home = "/opt/hadoopslave" data_dir = "/opt/hadoopslave/data" sub install (master : Hadoop1Master) { condition { this.installed != true master.parent.created = true this.java.installed = true } effect { this.installed = true this.master = master } } sub start (master : Hadoop1Master) { condition { this.running != true this.installed = true this.master = master master.running = true } effect { this.running = true } } }