๐Ÿš€ How To Install and Configure Ansible on Ubuntu 22.04

Sagar ShahSagar Shah
2 min read

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! ๐Ÿš€โœจ

10
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! โœจ