Skip to content

G2Tech-co/g2-iaas-ansible

Repository files navigation

G2 Ansible IaC (Infrastructure as code)

Idempotent playbooks

Ansible doc

Roles

  • Essentials
  • Swap
  • Docker (latest)
  • Traefik (traefik:2.9)
  • MySQL (mysql:8.0-debian)
  • Redis (redis:7.0-bullseye)
  • Node exporter (latest)
  • Gitlab runner (latest)
  • Reboot

Setup

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
ansible-galaxy install -r requirements.yml
# ansible-galaxy role install geerlingguy.docker

Run

Add ssh config host name to hosts

ansible-playbook setup.yml

ansible localhost -m ping
ansible all -i ./inventories/hosts -m ping

Vault

ansible-vault encrypt_string --name 'password_name'

Must changes

Swap: 2G
Traefik: auth
MySQL: auth
Redis: auth

TODOs

  • Limit containers ram & cpu
  • Disaster recovery plan
  • Docker compose v2

Testing

docker -H ssh://ansib exec -it mysql mysql -u <username> -p <database>
docker -H ssh://ansib exec -it redis redis-cli -p 6379 -a 'password' ping

Releases

No releases published

Packages

No packages published

Languages