ansible-install | ansible | ansible-ntp | ansible-rhel
you want v2.15+ for the new-style debian repo 822 to work
you also might prefer 2.16 over 2.17 to remain compatible with python 3.6 target systems
go for the official one for ubuntu but also works for debian
# no exist
ls -lhF /usr/share/keyrings/*ansible*
ls -lhF /etc/apt/sources.list.d/*ansible*
apt install gnupg1 lsb-release
keyid=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367
wget "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=$keyid" \
    -O /usr/share/keyrings/ansible.key
gpg1 --dearmor < /usr/share/keyrings/ansible.key > /usr/share/keyrings/ansible.gpg
–either– choose the appropriate distro to get latest version
# bookworm goes jammy lsb_release -cs 2>/dev/null UBUNTU_CODENAME=jammy
cat > /etc/apt/sources.list.d/ansible.list <<EOF deb [signed-by=/usr/share/keyrings/ansible.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu $UBUNTU_CODENAME main EOF
–or– if you need v2.16 precisely, go for mantic (as of Feb 2025)
cat > /etc/apt/sources.list.d/ansible.list <<EOF deb [signed-by=/usr/share/keyrings/ansible.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu mantic main EOF
and proceed – also get rsync in there, as for the synchronize module
apt update
    apt show ansible-core | grep ^Version
apt install ansible-core rsync
fixup
ls -lF /etc/ansible/ansible.cfg rmdir /etc/ansible/roles/
not sure you can install those right away, maybe setup ansible.cfg first
    ansible-galaxy collection install -fiUp /usr/share --force-with-deps community.general
    ansible-galaxy collection install -fiUp /usr/share --force-with-deps ansible.posix
    ansible-galaxy collection install -fiUp /usr/share --force-with-deps community.docker
same goes if you need to upgrade one of those at some point (-U / --upgrade is already there)
https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-debian-11