Skip to content

Playbooks to bootstrap and configure my VMs

License

Notifications You must be signed in to change notification settings

PScoriae/ansible-playbooks

Repository files navigation

Ansible CaC

Table of Contents
  1. About
  2. Installation
  3. Usage

About

This repository is concerned with the configuration and bootstrapping of AWS EC2 RHEL/CentOS/Rocky Linux instances for my personal projects using Ansible CaC.

Currently, this is what the bootstrap script playbooks/bootstrap-servers.yaml does:

Item Rationale
2GB swapfile EC2 Amazon Linux 2 AMI doesn't come with swapfile and may run into OOM issues
Docker Required to host PCPartsTool software architecture
Docker Registry Private registry for push and pull of PCPartsTool images between servers
.pem key Authentication for CICD server to SSH into Web server
pnpm pnpm is the package manager used for PCPartsTool
Jenkins CICD software for the build server
libappindicator-gtk3, liberation-fonts Packages required for Playwright E2E testing
Ansible For Jenkins post-build deployment process to web server
Prometheus, Grafana, Node Exporter Monitoring and Observability on CICD and Web server
Nginx Reverse proxy server from DNS A record to app-specific ports

Note: This is just one of multiple repositories that contribute to my personal projects. Here are all the related repositories:

Repository Built With Description
PCPartsTool SvelteKit, TypeScript, Tailwind CSS, MongoDB, Jenkins, Docker, Playwright The SvelteKit MongoDB WebApp
PCPartsTool-Scraper JavaScript, Jenkins, Docker Scraping Script to Gather E-commerce Item Data
terraform-infra Terraform, Cloudflare, AWS Terraform IaC for PCPartsTool Cloud Infrastructure
ansible-ec2 Ansible, Prometheus, Grafana, Nginx, AWS Ansible CaC for AWS EC2 Bootstraping, Observability and Maintenance
shuttleday React, TypeScript, MUI, Node.js, Docker, Express, MongoDB Badminton Scheduling and Information Webapp

Installation

This section guides you on how to setup this repo for use within the context of my personal projects' infrastructure.

  1. In your desired project folder, clone the project with the following command:

    git clone https://github.com/PScoriae/ansible-ec2
  2. Create a inventory file in the root directory of your project. It holds the private IP addresses to your server infrastructure. You may refer to inventory.example

  3. Add config-files/main-key.pem or whatever public key you use to authenticate the CICD build server to the web server.

Usage

After installation, simply run the following commands from your root directory to execute the playbooks:

# bootstrap new EC2 servers
ansible-playbook playbooks/bootstrap-servers.yaml

# update all packages on EC2 servers
ansible-playbook playbooks/yum-update.yaml