Skip to content

Pritunl AWS VM Server with MongoDB Atlas (Free Tier) IaC using Terraform - (for Development Purpose)

Notifications You must be signed in to change notification settings

nathanielvarona/pritunl-aws-vm-server-dev

Repository files navigation

Provision Initial VM using Terraform

Prepare the Environment

Create a copy and fill in the required environment variables fields

cp ./.envrc.dist ./.envrc

Load the environment variables in your current working shell

set -a && source ./.envrc && set +a

Install Terraspace (a Terraform Framework) Requirements

Create a Ruby Environment (Gemset)

rbenv gemset create 3.1.2 pritunl-aws-vm-single-server

Install the required Gemset for Terraspace Framework

bundle install

Install Terraform Vendor Modules from Terraform Registry

terraspace bundle

Provision the VM

Plan and Provision a VM

terraspace all plan
terraspace all up

Monitor the Operations by outputting the logs

terraspace logs -f

Provision Existing VM using Ansible

Ansible Provisioning Requirements

Prepare the Environment

cd ./provisioning
python -m venv ./.venv
source ./.venv/bin/activate

Ansible Base (Core Distribution)

pip install -r requirements.txt

AWS Plugin

ansible-galaxy collection install amazon.aws

AWS Compute Resource Inventory Checks

Show AWS EC2 Resource

ansible-inventory -i aws_ec2.yml --graph
ansible tag_Name_pritunl_vm -i aws_ec2.yml -m ping

Basic Usage

Check for Possible Changes (Dry Run)

ansible-playbook -i aws_ec2.yml main.yml --check

Install the Updates (Approve for any changes)

ansible-playbook -i aws_ec2.yml main.yml

Advance Usage

Only for APT Check/Changes

ansible-playbook -i aws_ec2.yml main.yml --tags "apt" --check

Only for SystemD Check/Changes

ansible-playbook -i aws_ec2.yml main.yml --tags "systemd" --check

TODO

  • Create a Packer Images for Initial VM Provisioning