Skip to content

step-2-ansible

Latest

Choose a tag to compare

@Itay-Ash Itay-Ash released this 15 Apr 13:46

📦 Release: Section 2 - VM Configuration with Ansible 🔄

This release marks the completion of Section 2 of the project: Automating VM configuration and service installation using Ansible.


🔧 What's Added in This Release:

  • Provisioned Ansible Server 🖥️

    • A dedicated VM was provisioned to run Ansible playbooks, enabling centralized orchestration across the infrastructure.
  • Storage Buckets 🗂️

    • One bucket stores the Ansible code, synced to the Ansible VM.
    • Another stores production code for other VMs.
  • Playbook Development & Execution 📜

    • Web Server 🌐
      • Developed a dedicated Ansible role.
      • Installed and configured NGINX.
      • Pulled frontend and backend application files from a GCP bucket.
      • Deployed the website using NGINX as the web server.
    • Database Server 🛢️
      • Developed a dedicated Ansible role.
      • Installed and configured MySQL.
      • Pulled necessary scripts from a GCP bucket.
      • Dynamically configured MySQL users and databases.
      • Pulled application data and tables from a GCP bucket.
    • CI/CD Server ⚙️
      • Installed and configured Jenkins.
  • Runtime Configuration ⚙️

    • Customized the ansible.cfg file to ensure consistent and optimized performance across all systems.
    • Developed wrapper scripts to take advantage of GCP’s SSH and SCP operations, enhancing ease of use and security.
  • Inventory Setup 📋

    • Created an inventory including the Web Server, DB Server, and CI/CD VM.
    • Defined custom variables to support GCP-specific access and connection methods.
  • Code Analysis and improvement 🧩

    • Separated Ansible tasks into roles for better organization and readability.
    • Reviewed code to identify redundancies and optimization opportunities.
    • Ensured modularity and reusability for future steps.
    • Improved the sample trivia website code for enhanced functionality and a more polished design.

🚀 Next Steps:

The current Ansible setup establishes a solid foundation for future automation.
However, I’ve extended Ansible’s capabilities to not only configure VMs but also execute dedicated code and scripts.
While the outcome was positive, the process proved too slow for production environments.
In the next phase, I aim to:

  • Integrate Ansible with CI/CD workflows to streamline operations and reduce execution time.
  • Optimize both Ansible and Terraform infrastructure to meet new requirements.
  • Explore Jenkins further to uncover new ways of enhancing my lab and addressing challenges.

📝 Notes:

This is my first time writing and organizing real-world Ansible automation inside a project.
While the current setup is functional and follows many best practices, I remain open to suggestions and improvements as I continue learning.
Overall, I’m satisfied with the outcome and proud of how the code has turned out.

For a full breakdown of this step, refer to the related issue: Section 2 - Virtual Machines Configuration with Ansible.
Feel free to explore the codebase, follow along, or suggest an idea!