-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from datagovsg/nomad-seperate
Separate out Nomad packer into clients and servers
- Loading branch information
Showing
20 changed files
with
145 additions
and
54 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.terraform | ||
terraform.tfstate.d | ||
terraform.tfstate.*.backup | ||
*.retry |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "modules/core/packer/roles/ansible-docker-ubuntu"] | ||
path = modules/core/packer/roles/ansible-docker-ubuntu | ||
url = https://github.com/lawliet89/ansible-docker-ubuntu.git |
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
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
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"subnet_id": "subnet-523e3a14", | ||
"temporary_security_group_source_cidr": "118.189.84.174/32" | ||
} |
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
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
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
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
modules/core/packer/nomad/README.md → modules/core/packer/nomad_clients/README.md
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
- name: Provision AMI | ||
hosts: all | ||
vars: | ||
nomad_version: "0.7.0" | ||
nomad_module_version: "v0.1.1" | ||
consul_module_version: "v0.1.0" | ||
consul_version: "1.0.1" | ||
docker_version: "17.11.0~ce-0~ubuntu" | ||
pre_tasks: | ||
- name: Upgrade all packages to the latest version | ||
apt: | ||
upgrade: yes | ||
update_cache: yes | ||
become: yes | ||
roles: | ||
- role: "{{ playbook_dir }}/../roles/consul" | ||
- role: "{{ playbook_dir }}/../roles/nomad" | ||
- role: "{{ playbook_dir }}/../roles/ansible-docker-ubuntu" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Nomad servers AMI | ||
|
||
AMI with Nomad and Consul binaries installed. DNSmasq is also configured to use the local | ||
Consul agent as its DNS server. | ||
|
||
This is based on this [example](https://github.com/hashicorp/terraform-aws-nomad/tree/master/examples/nomad-consul-ami). | ||
|
||
## Configuration Options | ||
|
||
See [this page](https://www.packer.io/docs/templates/user-variables.html) for more information. | ||
|
||
- `ami_base_name`: Base name for the AMI image. The timestamp will be appended | ||
- `aws_region`: AWS Region | ||
- `subnet_id`: ID of subnet to run the builder instance in | ||
- `temporary_security_group_source_cidr`: Temporary CIDR to allow SSH access from | ||
- `associate_public_ip_address`: Associate to `true` if the machine provisioned is to be connected via the internet | ||
- `ssh_interface`: One of `public_ip`, `private_ip`, `public_dns` or `private_dns`. If set, either the public IP address, private IP address, public DNS name or private DNS name will used as the host for SSH. The default behaviour if inside a VPC is to use the public IP address if available, otherwise the private IP address will be used. If not in a VPC the public DNS name will be used. | ||
- `nomad_version`: Version of Nomad to install | ||
- `consul_module_version`: Version of the [Terraform Consul](https://github.com/hashicorp/terraform-aws-consul) repository to use | ||
- `nomad_module_version`: Version of the [Nomad Module](https://github.com/hashicorp/terraform-aws-nomad) to use. | ||
- `consul_version`: Version of Consul to install | ||
|
||
## Building Image | ||
|
||
```bash | ||
packer build \ | ||
-var-file=vars.json \ | ||
packer.json | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"min_packer_version": "1.1.2", | ||
"variables": { | ||
"ami_base_name": "l-cloud-nomad-servers", | ||
"aws_region": "ap-southeast-1", | ||
"subnet_id": "", | ||
"temporary_security_group_source_cidr": "0.0.0.0/0", | ||
"associate_public_ip_address": "true", | ||
"ssh_interface": "", | ||
"nomad_version": "0.7.1", | ||
"consul_module_version": "v0.1.1", | ||
"nomad_module_version": "v0.1.1", | ||
"consul_version": "1.0.3", | ||
"docker_version": "18.02.0~ce-0~ubuntu" | ||
}, | ||
"builders": [ | ||
{ | ||
"name": "ubuntu-1604-nomad-server-ami", | ||
"ami_name": "{{ user `ami_base_name` }}-{{isotime | clean_ami_name}}", | ||
"ami_description": "An Ubuntu 16.04 AMI that has Nomad and Consul installed.", | ||
"instance_type": "t2.micro", | ||
"region": "{{user `aws_region`}}", | ||
"type": "amazon-ebs", | ||
"subnet_id": "{{user `subnet_id`}}", | ||
"associate_public_ip_address": "{{user `associate_public_ip_address`}}", | ||
"ssh_interface": "{{user `ssh_interface`}}", | ||
"temporary_security_group_source_cidr": "{{user `temporary_security_group_source_cidr`}}", | ||
"source_ami_filter": { | ||
"filters": { | ||
"virtualization-type": "hvm", | ||
"architecture": "x86_64", | ||
"name": "*ubuntu-xenial-16.04-amd64-server-*", | ||
"block-device-mapping.volume-type": "gp2", | ||
"root-device-type": "ebs" | ||
}, | ||
"owners": [ | ||
"099720109477" | ||
], | ||
"most_recent": true | ||
}, | ||
"ssh_username": "ubuntu" | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"type": "ansible", | ||
"pause_before": "10s", | ||
"playbook_file": "{{ template_dir }}/site.yml", | ||
"extra_arguments": [ | ||
"--extra-vars", | ||
"nomad_version={{user `nomad_version`}} consul_module_version={{user `consul_module_version`}} nomad_module_version={{user `nomad_module_version`}} consul_version={{user `consul_version`}} docker_version={{user `docker_version`}}", | ||
"-e", | ||
"ansible_python_interpreter=/usr/bin/python3" | ||
] | ||
} | ||
] | ||
} |
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
Submodule ansible-docker-ubuntu
added at
bf7f9c
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
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