#!/usr/bin/env bash
# install-ansible.sh
# Ansible — Agentless configuration management and application deployment.
# Target: Ubuntu / Debian. Safe to re-run.
# Source guide: devops-hub/tools/ansible.html

set -euo pipefail

if [[ $EUID -eq 0 ]]; then
  echo "Run this as a regular sudo-capable user, not root." >&2
  exit 1
fi

echo "==> Update package index"
sudo apt update

echo "==> Install the PPA (optional, latest release)"
sudo apt install -y software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible

echo "==> Install Ansible"
sudo apt install -y ansible

echo "==> Verify"
ansible --version

echo "==> Done. Ansible installation finished."
