diff --git a/README.md b/README.md index abf1d64507a6cfe8ba4040f9f5ee6552dd79b8ec..3da0c6a3caf6e018be7148e73c9fcc6bc2b09d4a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Build Hadoop cluster in OpenStack with Terraform. -Primary goal of this project is to build Hadoop cluster. But the most part is generic - Hadoop deployment can be replaced by implementing different deployment type (providing user-data and optionally implementing plugin for orchestration). +Primary goal of this project is to build Hadoop cluster. But the most part is generic - the Hadoop deployment can be skipped, or replaced by implementing different deployment type (see *deployments* directory). # Requirements diff --git a/deploy.tf b/deploy.tf index ada9f0299ae4d8fce173da1886045c52977bbd33..4cf61ab0fc71175290811d74e242189c2210ad1f 100644 --- a/deploy.tf +++ b/deploy.tf @@ -12,7 +12,7 @@ data "template_file" "user_data_common" { } data "template_file" "user_data" { - template = file("${var.type}/ctx.yaml") + template = file("deployments/${var.type}/ctx.yaml") } data "template_cloudinit_config" "user_data" { diff --git a/hadoop-hdfs/ctx.yaml b/deployments/hadoop-hdfs/ctx.yaml similarity index 100% rename from hadoop-hdfs/ctx.yaml rename to deployments/hadoop-hdfs/ctx.yaml diff --git a/hadoop-hdfs/plugin.py b/deployments/hadoop-hdfs/plugin.py similarity index 100% rename from hadoop-hdfs/plugin.py rename to deployments/hadoop-hdfs/plugin.py diff --git a/hadoop-hdfs/site.pp.tmpl b/deployments/hadoop-hdfs/site.pp.tmpl similarity index 100% rename from hadoop-hdfs/site.pp.tmpl rename to deployments/hadoop-hdfs/site.pp.tmpl diff --git a/hadoop/ctx.yaml b/deployments/hadoop/ctx.yaml similarity index 100% rename from hadoop/ctx.yaml rename to deployments/hadoop/ctx.yaml diff --git a/hadoop/plugin.py b/deployments/hadoop/plugin.py similarity index 95% rename from hadoop/plugin.py rename to deployments/hadoop/plugin.py index c018b328c7bffc5f860fc3234fefd2f980afdc76..b86c171b755bbcd20e901b2c62af16f73c88181a 100644 --- a/hadoop/plugin.py +++ b/deployments/hadoop/plugin.py @@ -23,7 +23,7 @@ class ComponentHadoop: if action == 'files': if not self.args.dry_run: template = None - with open('%s/site.pp.tmpl' % self.config['type'], 'r') as f: + with open('deployments/%s/site.pp.tmpl' % self.config['type'], 'r') as f: template = string.Template(f.read()) if template: print('-> site.pp') diff --git a/hadoop/site.pp.tmpl b/deployments/hadoop/site.pp.tmpl similarity index 100% rename from hadoop/site.pp.tmpl rename to deployments/hadoop/site.pp.tmpl diff --git a/deployments/none/ctx.yaml b/deployments/none/ctx.yaml new file mode 100644 index 0000000000000000000000000000000000000000..174b75155af67b48ba36c05c1e4599e39cdd876d --- /dev/null +++ b/deployments/none/ctx.yaml @@ -0,0 +1,7 @@ +#cloud-config + +merge_type: + - name: list + settings: [append] + - name: dict + settings: [recurse_array] diff --git a/orchestrate.py b/orchestrate.py index a74b10321065de253043e2f155b4cb2295565000..06c7d67a123be4f392ae6b9dfa558474dcedd43d 100755 --- a/orchestrate.py +++ b/orchestrate.py @@ -55,9 +55,9 @@ user = config['image_user'] t = config.get('type', None) print('== plugin ==') -if t and os.path.exists('%s/plugin.py' % t): - print('-> %s/plugin.py' % t) - plugin = importlib.import_module('%s.plugin' % t) +if t and os.path.exists('deployments/%s/plugin.py' % t): + print('-> deployments/%s/plugin.py' % t) + plugin = importlib.import_module('deployments.%s.plugin' % t) Component = getattr(plugin, 'Component') component = Component(args, config, hosts) else: