Following my completion of the Terraform section of my DevOps learning journey, I moved right into Ansible, thanks to the same comprehensive Udemy course: DevOps Beginners to Advanced with Projects. While the course included a detailed section on Terraform, it also provided a solid introduction to Ansible, which I found incredibly valuable.

Why Ansible?

Ansible is an agentless configuration management tool that allows you to automate server provisioning, software installation, and configuration tasks. Since it’s written in Python and uses simple YAML-based playbooks, it’s beginner-friendly and powerful.

My First Experience with Ansible

We covered the basics in the course just enough to start writing playbooks and executing tasks on remote servers. Even with that introductory exposure, I quickly saw the value Ansible brings to a DevOps workflow.

Quick Tips I Learned

Here are a few helpful takeaways from my first experience with Ansible:

1. Use Descriptive Playbooks

Clear naming and well-placed comments go a long way. Your playbooks should be easy to scan and understand.

---
- name: Install Nginx on Ubuntu server
  hosts: web
  become: true
  tasks:
    - name: Update apt repo cache
      apt:
        update_cache: yes

    - name: Install nginx
      apt:
        name: nginx
        state: present

Inventory Files Matter

Structuring your inventory (hosts) file properly is crucial. You can group servers and assign variables like SSH credentials to specific hosts.

[web]
192.168.1.10 ansible_user=ubuntu ansible_ssh_private_key_file=~/.ssh/id_rsa

Test with ansible -m ping

The ping module is a great way to test your Ansible setup before running full playbooks:

ansible all -m ping -i hosts

Use Variables Wisely

Variables help keep your playbooks DRY and flexible. You can define them inline or in separate files.

vars:
  nginx_package: nginx

YAML Formatting is Strict

YAML doesn’t tolerate mistakes. Be careful with spacing and indentation especially in nested structures.

What’s Next?

Though I’ve only scratched the surface of Ansible, I’m excited to incorporate it into more of my personal projects, especially for:

  • Server provisioning
  • App deployments
  • Configuration tasks across VMs

Next, I plan to explore more advanced topics like roles, templates, and handlers.

Final Thoughts

Ansible and Terraform complement each other well terraform handles infrastructure provisioning, while Ansible takes care of configuration. Learning both as part of a broader DevOps curriculum has given me a much better understanding of modern automation workflows.

If you’re new to configuration management or looking to reduce repetitive server tasks, Ansible is a great place to start. And if you’re enrolled in the DevOps Beginners to Advanced with Projects course like I was, you’re already off to a strong start.