← All insightsGetting Started

Getting started with Ansible

CodeWizard Engineering · 11 August 2026 · 3 min read · Beginner

Ansible configures servers and orchestrates deploys using idempotent 'playbooks' - YAML that describes desired state and runs over SSH with no agent to install on the targets.

Why teams use it

  • Agentless: it only needs SSH and Python on the target
  • Idempotent modules converge a host to the desired state repeatedly and safely
  • Readable YAML that doubles as executable documentation

Install it

bash
python3 -m pip install --user ansible
ansible --version
ansible all -i inventory.ini -m ping

A first working config

A playbook that installs and enables nginx idempotently.

yaml
- hosts: web
  become: true
  tasks:
    - name: Install nginx
      ansible.builtin.package:
        name: nginx
        state: present
    - name: Ensure nginx is running and enabled
      ansible.builtin.service:
        name: nginx
        state: started
        enabled: true
    - name: Deploy site config
      ansible.builtin.template:
        src: site.conf.j2
        dest: /etc/nginx/conf.d/site.conf
      notify: reload nginx
  handlers:
    - name: reload nginx
      ansible.builtin.service: { name: nginx, state: reloaded }

Run and verify

bash
ansible-playbook -i inventory.ini site.yml --check   # dry run
ansible-playbook -i inventory.ini site.yml --diff
ansible-vault encrypt group_vars/prod/secrets.yml

Mistakes to avoid early

  • Non-idempotent shell/command tasks that run every time regardless of state
  • Secrets in plaintext instead of Ansible Vault
  • Giant single playbooks instead of reusable roles

Want senior help putting Ansible to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult