This repository provides Ansible playbooks to set up a minimal infrastructure for a simple self-hosted application. Ideal for small hobby projects. I made this repository a place to Learn about DevOps and Cloud Infrastructure. You have all the tutorial you need to get started.
Features:
- docker-swarm
- Caddy
- Portainer
- Prometheus
- Graphana
The articles/tutorials are divided into sections.
- Introduction -> What are the tools to manage infrastructure? Perfect to learn the basis.
- How-tos -> Good takeaway from this project - Answers many questions you could encounter in the future
- Main quest -> Deploy the Infrastructure using Ansible, Terraform and Github Action
- Deepening Understanding -> Learn more about each application used in this setup (Portainer, Graphana, Caddy, etc.)
I used DigitalOcean for experiments because it is cheap, but any cloud provider should work, as we are mainly playing with Virtual Machines. You can even get $200 DigitalOcean free credit when starting
- Don't forget to delete everything after a tutorial if you don't want to add unnecessary costs
- WIP: 📚 1: What is Terraform and why you might need it.
- 📚 2: What is Terraform Cloud and why you might need it.
- WIP: 📚 3: What is Github Action and why you might need it.
- WIP: 📚 4: What is Ansible and why you might need it.
- WIP: 📚 5: What is Ansible AWX and why you might need it.
- 🌍 How to configure GitHub Environments with Terraform?
- 🏭 How to provision VM on Digital Ocean with Terraform?
- 🔏 How to create SSH keys with Terraform?
- 🗺️ How to create Ansible Inventory with Terraform?
- 👩 How to run an Ansible playbook using GitHub Action?
- 🧰 1: Design and Test Ansible playbook with Vagrant
- Example code .articles/1_vagrant_101
- 🧰 2 Experimenting on Docker Swarm with Vagrant and Ansible
- Example code .articles/2_docker_swarm_101
- WIP: 🧰 3: Automate Infrastructure provisioning with Ansible and Github action
- WIP: ☸️ 1: What is Portainer and why you might need it.
- WIP: ☸️ 2: What is Prometheus and why you might need it.
- WIP: ☸️ 3: What is Caddy and why you might need it.
Below, I've included some explainers on how I solved a specific problem when I encountered it. This should demistify some of the magic happening in this repo.
- 🏃♂️ 1: Speedup Ansible Playbook Pull-Requests by only running affected roles
- WIP 🏃♂️ 2: How to rotate Docker Secrets with Ansible
- WIP 🏃♂️ 3: How to implement Pull-Request locking for Ansible
Do you want to go fast? Too lazy to set up your local environment?
Then, use the tools from a Docker container. I included a simple Toochain in this repository and a useful alias for it.
Use common infrastructure tools in docker with:
source ./bin/docker_tools_alias.sh
use dasb for ansible in docker
use dap for ansible-playbook in docker
use daws for awscli in docker
use dpk for packer in docker
use dtf for terraform in docker
use dbash for bash in docker
With docker swarm and portainer it because easy to manager multiple nodes.