This file contains 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
#!/bin/bash | |
# Script to instruct the Mac how to route packets to the | |
# software defined network where containers created via docker machine | |
# reside. This lets you casually directly to ports (ssh, http, etc. etc.) | |
# on those containers. | |
if [ -z "$1" ]; then | |
echo "Please supply the name of the docker-machine VM${NC}" | |
exit 1 | |
fi |
This file contains 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
# | |
# maps the hostvars from ec2 tags in the dynamic inventory to the var names expected by our roles | |
# this allows us to have no host var files and alsonot have host specific vars in the group_vars files as these are only evaluated in the scope | |
# of the current host the play is being applied to i.e. all host dont have a seperate copy of all the facts. | |
# this leads to a dangerous situation when using jinja2 loops over nodes in groups and then accessing hostvars | |
# (that have been set in the groupvars) for that node | |
# | |
- hosts: all | |
tasks: |
This file contains 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
# | |
# Map the ec2 groups (from the dynamic inventory ec2.py) to our groups. | |
# This merges the static and dynamic inventory. | |
# | |
# Placeholders for the dynamic ec2 groups must be added to the static inventory. | |
# You can then use them throughout the rest of the inventory | |
[tag_kafka_yes] | |
# map all dynamic instances tagged with 'tag_kafka_yes' into the static kafka group |
This file contains 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
# must be between 1 and 255 | |
ZOOKEEPER_SERVER_ID: "{% set zk_id = groups['zookeeper'].index(inventory_hostname)+1 %}{{ zk_id }}" | |
ZK_PORT: 2181 | |
# must have preceeding comma as it is being appended onto the tags list!! | |
GROUP_TAGS: ",'zookeeper_server_id': {{ ZOOKEEPER_SERVER_ID }}" |
This file contains 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
# dummy inventory for provisioning blank zookeeper, kafka and kubenetes instances | |
[zookeeper] | |
zookeeper-0[1:3] | |
[kafka] | |
kafka-0[1:3] | |
[kubernetes] | |
kube-master-01 | |
kube-minion-01 |
This file contains 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
- hosts: all # run for all hosts in the inventory | |
connection: local # ec2 module runs locally, no need to connect to a non existant host! | |
gather_facts: False | |
vars: | |
# build up dictionary of tags so we can use them as facts in the dynamic inventory when configuring the instances | |
TAGS: "{'env': 'Test', 'Name': '{{ inventory_hostname }}', {% for group in group_names %}'{{ group }}':'yes'{% if not loop.last %},{% endif %}{% endfor %}{{ GROUP_TAGS | default() }} }" | |
tasks: | |
- name: Provision an instance {{ inventory_hostname }} | |
ec2: |
This file contains 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
package com.newsweaver.spark.test | |
import org.apache.spark.{SparkConf, SparkContext} | |
/** | |
* simple Spark app to calculate Pi | |
*/ | |
object EstimatePiSparkApp { | |
def main(args: Array[String]) { |