DEV Community

Cover image for Week 6 of my DevOps Journey : Mastering Variables, JSON & YAML
Mritunjay Tiwari
Mritunjay Tiwari

Posted on

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:

πŸ“˜ Learn YAML in Y Minutes: https://learnxinyminutes.com/docs/yaml

πŸ“˜ JSON vs YAML – What’s the Difference?: https://www.json2yaml.com

πŸ“Ί JSON & YAML Crash Course (YouTube): https://www.youtube.com/watch?v=cdLNKUoMc6c

πŸ“˜ DevOps Variable Guide by Educative: https://www.educative.io/blog/devops-variables

βœ… JSON Formatter & Validator: https://jsonlint.com

πŸ› οΈ 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 YAML

Use only spaces, no tabs. Tools like YAML Lint help.

unexpected end of JSON input

Use JSONLint to find missing commas/brackets.

Variable not found

Ensure it’s exported (export VAR=value) and accessed correctly ($VAR)

YAML list parsing issues

Use - 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

Top comments (0)