WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

This repository contains Ansible playbooks, service definitions, and configuration files to automate the end-to-end deployment of the Roboshop microservices application. It covers all major components, including: πŸ›’ Cart πŸ“¦ Catalogue πŸ‘€ User πŸ’³ Payment 🚚 Shipping 🌐 Frontend πŸ—„οΈ MongoDB 🐬 MySQL πŸ‡ RabbitMQ 🧠 Redis

Notifications You must be signed in to change notification settings

MAHALAKSHMImahalakshmi/ansibleRoboshop

Repository files navigation

πŸš€ ansibleRoboshop: My Ansible Automation Journey πŸ› οΈβœ¨

Welcome! This repository showcases my hands-on automation of the Roboshop microservices stack using Ansible.
Each playbook reflects my growth, troubleshooting wins, and practical DevOps experience. 🌱


πŸ“š How I Learned

  • πŸ“ Official Ansible Documentation for best practices and syntax.
  • πŸ€– ChatGPT for debugging help and YAML tips.
  • πŸ” Trial and error with MongoDB and MySQL data loading.

πŸ—‚οΈ What’s Inside

πŸ“¦ Playbooks for Microservices & Components

  • πŸƒ mongodb.yaml – Install & configure MongoDB
  • 🐬 mysql.yaml – Install & secure MySQL
  • 🧊 redis.yaml – Setup Redis
  • πŸ‡ rabbitmq.yaml – Setup RabbitMQ
  • πŸ“¦ catalogue.yaml – Node.js app with MongoDB Screenshot
  • πŸ‘€ user.yaml – Node.js with MongoDB & Redis Screenshot
  • πŸ›’ cart.yaml – Node.js with Redis & Catalogue Screenshot
  • 🚚 shipping.yaml – Java app with MySQL Screenshot
  • πŸ’³ payment.yaml – Python app with RabbitMQ Screenshot
  • 🌐 frontend.yaml – Nginx static frontend Screenshot

🐞 Troubleshooting & Key Learnings

  • Module Usage:

    • Used ansible.builtin.* modules for most tasks (install, copy, user, file, service).
    • Leveraged community.general.npm for Node.js dependencies and community.mysql.mysql_db for MySQL data import.
  • Loading Data Challenges:

    • MongoDB:

      • Loading initial data required using the shell module and careful handling of command output and conditions.
      • Example:
        - name: check products loaded or not
          ansible.builtin.command: mongosh --host mongodb.srivenkata.shop --eval 'db.getMongo().getDBNames().indexOf("catalogue")'
          register: catalogue_output
        
        - name: load products
          ansible.builtin.shell: mongosh --host mongodb.srivenkata.shop < /app/db/master-data.js
          when: catalogue_output.stdout | int < 0
      • Faced issues with string/integer conversion and learned to use Jinja2 filters (| int).
    • MySQL:

      • Used community.mysql.mysql_db to import SQL files.
      • Had to ensure MySQL was running and credentials were correct.
  • Common Errors & Fixes:

    • User Module:
      • Learned about system: true and create_home options for system users.
    • File Paths:
      • Used remote_src: yes for unarchiving files already present on the remote host.
    • Service Reloads:
      • Always reloaded systemd after copying new service files.
  • Debugging Approach:

    • Checked Ansible output for failed tasks.
    • Used ansible.builtin.debug to print variables and outputs.
    • Searched Ansible docs and asked ChatGPT for error explanations.

🏁 How to Use This Repo

  1. Clone the repository:

    git clone https://github.com/yourusername/ansibleRoboshop.git
    cd ansibleRoboshop
  2. Edit inventory.ini with your hostnames.

  3. Run a playbook a specific component:

ansible-playbook -i inventory.ini -e "ansible_user=<user>" -e "ansible_password=<password>" <component-playbook>.yaml

Replace <component-playbook> with e.g., catalogue.yaml. -Example 🌟

ansible-playbook -i inventory.ini -e "ansible_user=<user>" -e "ansible_password=<password>" catalogue.yaml

🌟 My Favorite Moments

  • πŸŽ‰ The first time all services started without errors!
  • 🐞 Debugging and finally loading data into MongoDB and MySQL.
  • 🀩 Seeing the Roboshop app running end-to-end, fully automated!

πŸ“– My Ansible Learning Journey πŸš€βœ¨

Explore my continuous learning adventure across these repositories, each showcasing different facets of my Ansible mastery:

  • πŸ“˜ learnAnsible – Hands-on tutorials and practical playbooks to build your Ansible foundation.
  • πŸ› οΈ ansibleRoboshop – Real-world microservices automation project applying modular Ansible practices.
  • πŸ“¦ rolesAnsibleRoboshop – Deep dive into reusable Ansible roles and advanced troubleshooting techniques.

Feel free to dive in, contribute, or ask questions anytime! Let’s collaborate and level-up automation skills together! πŸ’‘πŸ€βœ¨


πŸ™ Credits & Contact πŸ’¬πŸ€—

  • Inspired by the innovative Roboshop microservices architecture and design pattern.
  • Automation and documentation craft by Mahalakshmi πŸ’»β€οΈ

About

This repository contains Ansible playbooks, service definitions, and configuration files to automate the end-to-end deployment of the Roboshop microservices application. It covers all major components, including: πŸ›’ Cart πŸ“¦ Catalogue πŸ‘€ User πŸ’³ Payment 🚚 Shipping 🌐 Frontend πŸ—„οΈ MongoDB 🐬 MySQL πŸ‡ RabbitMQ 🧠 Redis

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published