Ansible automation sounds abstract until you see it in action. Here are five real-world examples of how I use Ansible to help small businesses eliminate repetitive IT tasks, reduce errors, and scale operations efficiently.
Example 1: New Server Deployment
The manual way:
Every time you need a new server, someone spends 2-4 hours:
- Installing the base operating system
- Configuring networking
- Setting up user accounts
- Installing required packages
- Hardening security settings
- Configuring monitoring
- Joining to centralized management
And inevitably, each server ends up slightly different because humans miss steps.
The Ansible way:
---
- name: Deploy new Linux server
hosts: new_servers
become: yes
roles:
- base_configuration
- security_hardening
- monitoring_agent
- backup_agent
What this does:
- base_configuration sets hostname, timezone, NTP, and DNS
- security_hardening applies 30+ security controls automatically
- monitoring_agent installs and configures monitoring
- backup_agent enrolls the server in backup
A 2-4 hour manual process becomes a 15-minute automated deployment. Every server is configured identically. Nothing gets forgotten.
Example 2: User Account Management
The manual way:
When someone joins the company:
- Create their account on each server they need access to
- Set up SSH keys
- Add to appropriate groups
- Document what access they have
When someone leaves:
- Try to remember everywhere they had access
- Manually remove their account from each system
- Hope you didn’t miss anything
The Ansible way:
---
# users.yml - single source of truth
users:
- name: john.smith
state: present
groups: ['developers', 'docker']
ssh_keys:
- "ssh-rsa AAAAB3..."
- name: jane.doe
state: present
groups: ['sysadmin', 'developers']
ssh_keys:
- "ssh-rsa AAAAB3..."
- name: departed.employee
state: absent # This removes the account everywhere
---
- name: Manage user accounts across all servers
hosts: all
become: yes
tasks:
- name: Manage users
user:
name: "{{ item.name }}"
state: "{{ item.state }}"
groups: "{{ item.groups | default([]) }}"
loop: "{{ users }}"
Add a user to the list: they exist everywhere within minutes. Change state: present to state: absent: they’re removed from every server automatically.
Example 3: Configuration Drift Prevention
The manual way:
Someone fixes a problem on Server A by tweaking a configuration. They forget to document it. Months later, the same problem appears on Server B. The original fix is lost.
Or worse: someone makes a change that works but introduces a security vulnerability. No one notices until the breach.
The Ansible way:
---
- name: Enforce sshd configuration
hosts: all
become: yes
tasks:
- name: Configure SSH daemon
template:
src: sshd_config.j2
dest: /etc/ssh/sshd_config
owner: root
mode: '0600'
validate: '/usr/sbin/sshd -t -f %s'
notify: restart sshd
Run this playbook weekly (or on every change):
- If someone manually modified the SSH config, it gets reverted to the known-good state
- If they introduced a security problem, it’s automatically fixed
- Every server stays identical to every other server
This is idempotent — you can run it a thousand times, and servers that are already correct remain untouched.
Example 4: Security Patching
The manual way:
- Log into each server
- Run updates
- Check for errors
- Reboot if necessary
- Repeat for 10, 20, 50 servers
- Spend an entire day on routine maintenance
The Ansible way:
---
- name: Security patching
hosts: all
become: yes
serial: 3 # Patch 3 servers at a time
tasks:
- name: Update all packages
dnf:
name: "*"
state: latest
security: yes
register: updates
- name: Reboot if kernel was updated
reboot:
reboot_timeout: 300
when: "'kernel' in updates.results | map(attribute='name') | list"
- name: Wait for server to come back
wait_for_connection:
timeout: 300
when: "'kernel' in updates.results | map(attribute='name') | list"
What this does:
- Patches servers three at a time (so you don’t take down everything at once)
- Automatically reboots if the kernel was updated
- Waits for servers to come back online before continuing
- Entire environment patched in an hour instead of a day
Example 5: Application Deployment
The manual way:
Deploying a new version of your application means:
- Download the new version
- Stop the application
- Back up the old version
- Copy new files into place
- Update configuration
- Start the application
- Verify it’s working
- Roll back manually if something goes wrong
Do this for each server. Hope nothing goes wrong at step 4 of 7 on a Friday afternoon.
The Ansible way:
---
- name: Deploy application
hosts: webservers
become: yes
serial: 1 # One server at a time for zero-downtime
tasks:
- name: Download new version
get_url:
url: "https://releases.example.com/app-{{ version }}.tar.gz"
dest: /tmp/app.tar.gz
- name: Stop application
systemd:
name: myapp
state: stopped
- name: Backup current version
archive:
path: /opt/myapp
dest: "/opt/backups/myapp-{{ ansible_date_time.date }}.tar.gz"
- name: Extract new version
unarchive:
src: /tmp/app.tar.gz
dest: /opt/myapp
remote_src: yes
- name: Start application
systemd:
name: myapp
state: started
- name: Verify application health
uri:
url: "http://localhost:8080/health"
status_code: 200
register: health_check
retries: 3
delay: 10
Deploy to one server at a time. Verify it’s healthy before moving to the next. If anything fails, the playbook stops before affecting more servers.
Getting Started with Ansible
These examples show what’s possible. Getting there requires:
- Inventory — Listing all your servers and how to reach them
- Playbooks — Defining what should be configured
- Testing — Verifying automation works before production use
- Documentation — Making the automation maintainable
The investment in automation pays off quickly. Tasks that took hours take minutes. Servers that drifted apart stay consistent. Human error in repetitive tasks drops to zero.
Ansible Automation Services
As a Red Hat-certified Ansible professional, I help Colorado businesses implement automation that actually works. From initial playbook development to ongoing refinement, I can help you:
- Eliminate repetitive manual IT tasks
- Ensure consistent configuration across all systems
- Reduce deployment time from hours to minutes
- Build a foundation that scales with your business
Interested in what Ansible automation could do for your business? Let’s discuss your specific environment and opportunities.