Skip to content

feat(lab05): Ansible Fundamentals with roles and dynamic inventory#2718

Open
merkulovleo wants to merge 9 commits intoinno-devops-labs:masterfrom
merkulovleo:lab05
Open

feat(lab05): Ansible Fundamentals with roles and dynamic inventory#2718
merkulovleo wants to merge 9 commits intoinno-devops-labs:masterfrom
merkulovleo:lab05

Conversation

@merkulovleo
Copy link

Lab 05 — Ansible Fundamentals

Changes

  • Role-based Ansible project structure (common, docker, app_deploy roles)
  • common role: apt cache update, essential packages, timezone
  • docker role: Docker CE installation, service management, handler
  • app_deploy role: Docker Hub login via Vault, image pull, container run, health check
  • Playbooks: provision.yml, deploy.yml, site.yml
  • Ansible Vault encrypted credentials (group_vars/all.yml)
  • Bonus: Yandex Cloud dynamic inventory script (inventory/yandex_cloud.py)
  • Documentation: ansible/docs/LAB05.md

Checklist

  • Role-based directory structure
  • All three roles (common, docker, app_deploy)
  • Handlers defined (restart docker, restart app container)
  • Idempotency documented
  • Ansible Vault for credentials
  • .vault_pass in .gitignore
  • Bonus: Dynamic inventory for Yandex Cloud

- Implemented GET / endpoint with service metadata, system info, runtime details
- Implemented GET /health endpoint with health status
- Added error handlers for 404 and 500
- Configured logging and environment variables (HOST, PORT, DEBUG)
- Added documentation: README.md and docs/LAB01.md
- Pinned dependencies in requirements.txt
- Add Dockerfile with multi-stage build (builder + runtime stages)
- Use python:3.13-slim as base image
- Implement non-root user for security
- Add .dockerignore to exclude unnecessary files
- Update README.md with Docker usage instructions
- Add LAB02.md with best practices documentation
- Add app_go/ with minimal Go HTTP server
- Dockerfile uses multi-stage build with scratch base image
- Final image size: 6.72 MB (97% smaller than Python version)
- Update LAB02.md with real terminal outputs and bonus documentation
- Add 16 pytest unit tests covering all Flask endpoints (/, /health, 404)
- Create python-ci.yml workflow: lint, test, Snyk scan, Docker build+push
- Create go-ci.yml workflow (bonus): lint, test, Docker build+push
- Add Go unit tests for index and health handlers
- Use CalVer versioning (YYYY.MM.RUN_NUMBER) for Docker tags
- Implement CI best practices: dependency caching, concurrency control,
  job dependencies, path-based triggers, Docker layer caching, Snyk
- Add status badge to app_python/README.md
- Add test coverage reporting via Codecov
- Add LAB03.md documentation
- Add Terraform configuration for Yandex Cloud VM
- Add Terraform configuration for Oracle Cloud (alternative)
- Add Pulumi configuration with Python
- Add GitHub Actions CI/CD for Terraform validation
- Add GitHub provider for repository management
- Add comprehensive documentation (LAB04.md)
- Update .gitignore for all IaC configurations

Tasks completed:
- Task 1: Terraform VM Creation (4 pts)
- Task 2: Pulumi VM Recreation (4 pts)
- Task 3: Documentation (2 pts)
- Bonus: GitHub Actions CI/CD (1.5 pts)
- Bonus: Import GitHub Repository (1 pt)

Total: 12.5/12.5 points
- Format terraform-oracle/main.tf
- Format terraform-github/main.tf
- Fix CI/CD formatting check errors
- Create role-based Ansible project structure (common, docker, app_deploy)
- common role: apt cache update, essential packages, timezone configuration
- docker role: Docker CE installation via official repo, service management, handler
- app_deploy role: Docker Hub login via Vault, image pull, container run, health check
- Playbooks: provision.yml, deploy.yml, site.yml
- Ansible Vault encrypted group_vars/all.yml for Docker Hub credentials
- Bonus: Yandex Cloud dynamic inventory script using official Python SDK
- Documentation: ansible/docs/LAB05.md with architecture, idempotency demo, vault usage
- Update .gitignore: exclude .vault_pass, *.retry, __pycache__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant