install
apt-get install software-properties-common
Add the Ansible repository to your system
$ sudo apt-add-repository ppa:ansible/ansible
Install Ansible
$ sudo apt-get update && sudo apt-get install ansible
error
add-apt-repository ppa:ansible/ansible
Cannot add PPA: 'ppa:ansible/ansible'.
Please check that the PPA name or format is correct.
You need to export your proxy environment variables using
export http_proxy=http://username:password@host:port/
export https_proxy=https://username:password@host:port/
and then tell sudo to use them using:
sudo -E add-apt-repository ppa:ansible/ansible
reference
*Install Ansible on 64-bit Ubuntu 14.04 LTS *Cannot Add PPA Behind Proxy Ubuntu 14.04 [duplicate]