From 38a8e79744e6b267f91e76097075b324c133222e Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 25 Nov 2021 01:09:29 -0800 Subject: [PATCH] + Gamma definition + Playbook for docker host Infra host definitions are all in place however a proper gateway setup is required since we're going to try and share a single elastic ip for the two web servers --- .gitignore | 1 + infra/gamma.tf | 20 +++++++++++++++ playbooks/setup-alpha-host.yml | 46 ++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 infra/gamma.tf create mode 100644 playbooks/setup-alpha-host.yml diff --git a/.gitignore b/.gitignore index 40a56f6..6595865 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ infra/keys/ infra/out.plan infra/terraform.tfstate infra/terraform.tfstate.backup +playbooks/hosts.ini diff --git a/infra/gamma.tf b/infra/gamma.tf new file mode 100644 index 0000000..f097197 --- /dev/null +++ b/infra/gamma.tf @@ -0,0 +1,20 @@ +variable "gamma_ssh_key_name" {} +variable "gamma_public_key_path" {} + +variable "gamma_instance_type" {} +variable "gamma_ami_id" {} + +resource "aws_key_pair" "gamma_ssh" { + key_name = var.gamma_ssh_key_name + public_key = file(var.gamma_public_key_path) +} + +resource "aws_instance" "gamma" { + ami = var.gamma_ami_id + instance_type = var.gamma_instance_type + + key_name = var.gamma_ssh_key_name + + security_groups = [ aws_security_group.gamma_sec.id ] +} + diff --git a/playbooks/setup-alpha-host.yml b/playbooks/setup-alpha-host.yml new file mode 100644 index 0000000..a1aa67c --- /dev/null +++ b/playbooks/setup-alpha-host.yml @@ -0,0 +1,46 @@ +--- +- hosts: alpha + remote_user: ubuntu + tasks: + - name: Install docker dependencies + become: yes + become_method: sudo + apt: + name: "{{item}}" + update_cache: yes + loop: + - apt-transport-https + - ca-certificates + - curl + - gnupg + - software-properties-common + - lsb-release + + - name: Install docker GPG key + become: yes + become_method: sudo + apt_key: + url: https://download.docker.com/linux/ubuntu/gpg + state: present + + - name: Add Docker Apt Repo + become: yes + become_method: sudo + apt_repository: + repo: deb https://download.docker.com/linux/ubuntu/gpg buster stable + state: present + + - name: Install Docker components + become: yes + become_method: sudo + apt: + name: "{{item}}" + update_cache: yes + loop: + - docker-ce + - docker-ce-cli + - containerd.io + + + +