🚀 Week 6 of my DevOps Journey : Mastering Variables, JSON & YAML

Mastering Variables, JSON & YAML

This week, I focused on the building blocks of configuration and automation in DevOps: variables, JSON, and YAML. These are essential for writing reusable, flexible, and structured code in modern Infrastructure as Code tools like Ansible, Terraform, Kubernetes, and CI/CD pipelines.


🔍 What I Learned:

📌 Variables in DevOps Scripts

  • Used variables in Bash scripts and Vagrantfile to make VM provisioning more dynamic.

  • Learned about environment variables (export VAR=value), default values, and scope (global vs local).

📄 JSON (JavaScript Object Notation)

  • Understood its role in config files, REST APIs, and cloud resource provisioning.

  • Practiced working with nested structures and arrays.

  • Learned to format, validate, and parse JSON for better readability.

🧾 YAML (YAML Ain’t Markup Language)

  • Explored YAML’s clean, readable syntax used in Docker Compose, GitHub Actions, Kubernetes, and Ansible.

  • Learned best practices like using spaces over tabs, document separation (---), and correct indentation.

  • Compared YAML vs JSON for real-world config management.


📚 Resources That Helped:


🛠️ Key Tasks I Completed:

  • ✅ Declared and used variables in Vagrant and shell scripts.

  • ✅ Created and validated multi-layered JSON files for configurations.

  • ✅ Wrote YAML files for simulated Kubernetes pods and CI/CD pipelines.

  • ✅ Converted JSON ↔ YAML for better readability and compatibility.

  • ✅ Identified and fixed common errors like wrong indentation and syntax.


⚠️ Common Errors & Quick Fixes:

❌ Error💡 Solution
bad indentation in YAMLUse only spaces, no tabs. Tools like YAML Lint help.
unexpected end of JSON inputUse JSONLint to find missing commas/brackets.
Variable not foundEnsure it’s exported (export VAR=value) and accessed correctly ($VAR)
YAML list parsing issuesUse - consistently and maintain indentation levels.

🎯 My Takeaway:

Variables, JSON, and YAML may seem basic — but they’re the language of automation. From Vagrant to Kubernetes, understanding these formats helps you control, scale, and debug infrastructure with precision.

Let’s connect if you’re learning YAML, writing automation configs, or exploring Infrastructure as Code!

#DevOps #Git #Vagrant #LinuxServers #InfrastructureAsCode #VersionControl #SSH #Virtualization #Automation #SystemAdministration

0
Subscribe to my newsletter

Read articles from Mritunjay Tiwari directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mritunjay Tiwari
Mritunjay Tiwari