This repository contains infrastructure-as-code (IaC) definitions and playbooks to automate deployment of the FleetCoreServer application using Terraform and Ansible.
- Terraform provisions cloud infrastructure (currently AWS only).
- Ansible configures servers and deploys the application from the GitHub repository.
- GitHub Actions provides an automated CI/CD pipeline for provisioning and configuration.
- Terraform
- Ansible
- AWS CLI v2 configured with valid credentials
- SSH key pair (Terraform can generate automatically if not provided)
- AWS credentials stored as GitHub Actions secrets:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
infra/
terraform/
main.tf
variables.tf
outputs.tf
terraform.tfvars.sample # template config (copy to terraform.tfvars)
ansible/
inventory/
hosts.ini (auto-generated)
group_vars/
all.yml # default vars (non-sensitive)
playbooks/
site.yml # main playbook
.github/
workflows/
deploy.yml # CI/CD workflow
Copy the sample file and edit as needed:
cd infra/terraform
cp terraform.tfvars.sample terraform.tfvarsUpdate values inside terraform.tfvars:
cloud_provider = "aws"
ssh_key_name = "fleetcore_key"
app_branch = "main"terraform init
terraform apply -auto-approveOutputs will include:
- Public IP(s) of instances
- SSH private key (if generated)
- Application branch
cd ../ansible
ansible-playbook -i inventory/hosts.ini playbooks/site.ymlPush changes to the main branch (or open PRs against it):
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]The workflow will:
- Run Terraform (
infra/terraform) - Save outputs (public IPs, private key, branch)
- Run Ansible to configure the servers and deploy FleetCoreServer
- Never commit
terraform.tfvarswith real values. - Only commit
terraform.tfvars.samplefor reference. - Use GitHub Secrets for AWS credentials and other sensitive data.
- The SSH private key generated by Terraform is stored as an artifact only during the workflow run.