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. π±
- π Official Ansible Documentation for best practices and syntax.
- π€ ChatGPT for debugging help and YAML tips.
- π Trial and error with MongoDB and MySQL data loading.
- π 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

- π€ user.yaml β Node.js with MongoDB & Redis

- π cart.yaml β Node.js with Redis & Catalogue

- π shipping.yaml β Java app with MySQL

- π³ payment.yaml β Python app with RabbitMQ

- π frontend.yaml β Nginx static frontend

-
Module Usage:
- Used
ansible.builtin.*modules for most tasks (install, copy, user, file, service). - Leveraged
community.general.npmfor Node.js dependencies andcommunity.mysql.mysql_dbfor MySQL data import.
- Used
-
Loading Data Challenges:
-
MongoDB:
- Loading initial data required using the
shellmodule 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).
- Loading initial data required using the
-
MySQL:
- Used
community.mysql.mysql_dbto import SQL files. - Had to ensure MySQL was running and credentials were correct.
- Used
-
-
Common Errors & Fixes:
- User Module:
- Learned about
system: trueandcreate_homeoptions for system users.
- Learned about
- File Paths:
- Used
remote_src: yesfor unarchiving files already present on the remote host.
- Used
- Service Reloads:
- Always reloaded systemd after copying new service files.
- User Module:
-
Debugging Approach:
- Checked Ansible output for failed tasks.
- Used
ansible.builtin.debugto print variables and outputs. - Searched Ansible docs and asked ChatGPT for error explanations.
-
Clone the repository:
git clone https://github.com/yourusername/ansibleRoboshop.git cd ansibleRoboshop -
Edit inventory.ini with your hostnames.
-
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
- π 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!
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! π‘π€β¨
- Inspired by the innovative Roboshop microservices architecture and design pattern.
- Automation and documentation craft by Mahalakshmi π»β€οΈ