Ansible
Ansible for DevOps & SRE (2025)
Why Use Ansible in DevOps & SRE?
Real-Life Examples
1. Multi-Cloud VM Provisioning (AWS & Azure)
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Launch AWS EC2 instance
amazon.aws.ec2_instance:
name: devops-ec2
key_name: my-key
instance_type: t3.micro
image_id: ami-0abcdef1234567890
region: eu-west-1
tags:
Owner: devops
register: aws_result
- name: Create Azure VM
azure.azcollection.azure_vm:
resource_group: devops-rg
name: devops-vm
vm_size: Standard_B1s
admin_username: azureuser
ssh_password_enabled: false
ssh_public_keys:
- path: /home/azureuser/.ssh/authorized_keys
key_data: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
image:
offer: UbuntuServer
publisher: Canonical
sku: 20.04-LTS
version: latest
location: westeurope
register: azure_result2. Automated Patch Management (Linux)
3. Kubernetes Manifest Deployment
4. Integrating with GitHub Actions
5. LLM Integration for Change Summaries
Best Practices (2025)
Common Pitfalls
References
Last updated