๐ How To Install and Configure Ansible on Ubuntu 22.04
What is Ansible?
Ansible, your DevOps superhero, simplifies tasks from software installation to configuration management across servers, saving time and ensuring consistency effortlessly.
Ansible in Action: A Heroic Tale
Picture overseeing 1000 servers, each craving the latest software. The manual route? A colossal, energy-draining labyrinth. Enter Ansible, the DevOps hero. With a script, it orchestrates software installation across all servers simultaneously, transforming complexity into a seamless symphony of efficiency. ๐ถ
You're not just an admin; you're the maestro scripting success with Ansible's heroic automation. Embrace the hero within, letting Ansible pave the way for streamlined, efficient operations. ๐โจ
Installation on Ubuntu
Fear not! Ansible comes to the rescue. Begin by installing Ansible on Ubuntu with these commands:
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository --yes --update ppa:ansible/ansible
$ sudo apt install ansible
Basic Commands
- Verifying Ansible Installation: Ensure Ansible is ready for action:
$ ansible --version
- Inventory Setup: Prepare a list of your servers in
inventory.ini
:
[servers]
server1 ansible_host=192.168.1.101
server2 ansible_host=192.168.1.102
# ... (for all 1000 servers)
[servers:vars]
ansible_python_interpreter=/usr/bin/python3
ansible_user=ubuntu
ansible_ssh_private_key_file=/home/ubuntu/.ssh/ansible-all-access-key.pem
- The Magic Touch: Ansible Playbook Craft a playbook, say
deploy.yml
, to install software (e.g., Nginx):
---
- hosts: servers
become: true
tasks:
- name: Install Nginx
apt:
name: nginx
state: present
Run the playbook:
$ ansible-playbook -i inventory.ini deploy.yml
The Grand Finale: Witness the magic unfold โ Ansible effortlessly installs software across all 1000 servers simultaneously, saving countless hours. Now, with Ansible, you're not just an admin; you're the orchestrator of DevOps magic. For further insights, explore the OpenSUSE Support Portal and delve into Ansible's enchanting capabilities in the official documentation.
Become the hero of your infrastructure with Ansible! ๐โจ
Subscribe to my newsletter
Read articles from Sagar Shah directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Sagar Shah
Sagar Shah
๐ Sagar Shah ๐ ๐ป DevOps Engineer ๐ก ๐ Automating the digital universe, one script at a time โ๏ธ ๐ Passionate learner and tech enthusiast ๐ค โ๏ธ Cloud explorer, making servers dance in the cloud ๐ฅ๏ธ ๐ ๏ธ Building bridges between development and operations ๐ ๐ Sharing insights and knowledge on all things DevOps ๐ข ๐ Let's transform the world of IT together! โจ