Skip to content

Commit

Permalink
Refactor structure (#1)
Browse files Browse the repository at this point in the history
* Restructure directories on high-level concepts.

* Fix cross references from docs.
  • Loading branch information
stefanvanwouw committed Sep 9, 2016
1 parent 4a568b5 commit 9fb3005
Show file tree
Hide file tree
Showing 49 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -35,7 +35,7 @@ ansible-playbook example-all.yml -i example-inventory/dev -e stack=dev-{some-nam
Note: do not forget to tear down all the components created when done experimenting, see wrap-up section of [Automatic EMR Deployment Guide](docs/2-automatic-emr-deployment/README.md).

## Ansible role structure and conventions
The Ansible [roles](roles/) directory contains all the roles that can be used. When following the standard best-practices for Ansible, each role contains a single component and/or service that can be deployed on one or more servers. Since we are focussing on infrastructure instead of software that is installed on a single server, we used the following rules of thumb for creating new roles:
The Ansible [roles](common/) directory contains all the roles that can be used. When following the standard best-practices for Ansible, each role contains a single component and/or service that can be deployed on one or more servers. Since we are focussing on infrastructure instead of software that is installed on a single server, we used the following rules of thumb for creating new roles:

1. In case of non-service specific, infrastructure related components, use a role per infrastructure layer. Example: network, routing, subnets.
2. In case of service specific components, use a role per service concept. Example: nat (provides internet service to private subnet VMs), vpn (provides access to the cluster to users), datalake (provides the whole configuration of an entire managed datalake; e.g. AWS EMR / Azure HDInsight as implementation).
Expand Down Expand Up @@ -79,4 +79,4 @@ This way it is possible to cross-reference between environments , e.g. hostvars[
They do not plan to fix this. See also: https://github.com/ansible/ansible/issues/9065

### Output convention
Each of the roles can generate output to use later when applying other roles in a sequence (rather than independently, which is also possible). The convention here is to define a dictionary variable equal to the role name and then have a subdictionary named "output". For example ``hostvars.aws_region_ireland.network_aws.output.network_id`` will contain the network ID (underlying VPC id in this case) generated by running network_aws in the [example-all.yml](example-all.yml) playbook for the ``aws_region_ireland`` variable group.
Each of the roles can generate output to use later when applying other roles in a sequence (rather than independently, which is also possible). The convention here is to define a dictionary variable equal to the role name and then have a subdictionary named "output". For example ``hostvars.aws_region_ireland.network_aws.output.network_id`` will contain the network ID (underlying VPC id in this case) generated by running network_aws in the [example-all.yml](data-science-cluster/example-all.yml) playbook for the ``aws_region_ireland`` variable group.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions data-science-box/ansible.cfg
@@ -0,0 +1,2 @@
[defaults]
roles_path = network:platform:../common/network:../common/platform
2 changes: 2 additions & 0 deletions data-science-cluster/ansible.cfg
@@ -0,0 +1,2 @@
[defaults]
roles_path = network:platform:../common/network:../common/platform
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions data-science-hub/ansible.cfg
@@ -0,0 +1,2 @@
[defaults]
roles_path = network:platform:../common/network:../common/platform
6 changes: 3 additions & 3 deletions docs/2-automatic-emr-deployment/README.md
Expand Up @@ -14,9 +14,9 @@ Amazon CloudFormation is used to automate deployment of AWS infrastructure compo

For the first assignment we will give some pointers and suggestions to automate [the datalake you manually provisioned here](../1-manual-emr-deployment/README.md). No step-by-step instructions are provided, but [sample solutions](../../README.md) are included in this repository for you to use as a reference.

1. As a first step, try to provision a VPC using Ansible's cloud formation module. To do this follow [this guide](http://docs.ansible.com/ansible/cloudformation_module.html), a sample solution can be found in the [network_aws module](../../roles/network_aws). Reference to VPC CloudFormation template [here](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html).
2. Next, try the same with provisioning routing tables (the private and public one for the VPC), a sample solution can be found in the [routing_aws module](../../roles/routing_aws). Reference to Routing table CloudFormation template [here](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html).
3. To finish the networking infrastructure, also automate the provisioning of the subnets of the data lake solution (the private and public subnets). A sample solution can be found in the [subnets_aws module](../../roles/subnets_aws). Reference to subnet CloudFormation components [here](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html), and to add them to the routing tables created earlier [here](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html).
1. As a first step, try to provision a VPC using Ansible's cloud formation module. To do this follow [this guide](http://docs.ansible.com/ansible/cloudformation_module.html), a sample solution can be found in the [network_aws module](../../common/network/network_aws). Reference to VPC CloudFormation template [here](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html).
2. Next, try the same with provisioning routing tables (the private and public one for the VPC), a sample solution can be found in the [routing_aws module](../../common/network/routing_aws). Reference to Routing table CloudFormation template [here](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html).
3. To finish the networking infrastructure, also automate the provisioning of the subnets of the data lake solution (the private and public subnets). A sample solution can be found in the [subnets_aws module](../../common/network/subnets_aws). Reference to subnet CloudFormation components [here](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html), and to add them to the routing tables created earlier [here](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html).
4. Try to come up with other roles for the remaining components (OpenVPN, NAT instance, AWS EMR cluster etc.).

# Designing for reusability
Expand Down
5 changes: 0 additions & 5 deletions instance-roles/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions roles/README.md

This file was deleted.

0 comments on commit 9fb3005

Please sign in to comment.