Ubuntu – installing ansible on ubuntu

add-apt-repositoryPROXYrepositorysoftware installation

I'm following this document to install ansible: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-ubuntu-14-04

I'm try to add ansible to my ubuntu repositories list but this is what happens:

me@mydev:~/Documents$ sudo apt-add-repository ppa:ansible/ansible
Cannot add PPA: 'ppa:~ansible/ubuntu/ansible'.
ERROR: '~ansible' user or team does not exist.
me@mydev:~/Documents$ 

I've also tried to just clone the repo (following these instructions: http://docs.ansible.com/ansible/intro_installation.html)
But that fails with the following:

me@mydev:~/Documents/ansible$ git clone git://github.com/ansible/ansible.git --recursive
Cloning into 'ansible'...
fatal: unable to connect to github.com:
github.com[0: 192.30.252.131]: errno=Connection timed out

me@mydev:~/Documents/ansible$ ping 192.30.252.131
PING 192.30.252.131 (192.30.252.131) 56(84) bytes of data.
64 bytes from 192.30.252.131: icmp_seq=1 ttl=56 time=23.4 ms
64 bytes from 192.30.252.131: icmp_seq=2 ttl=56 time=23.5 ms
^C
--- 192.30.252.131 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 23.466/23.511/23.557/0.159 ms
me@mydev:~/Documents/ansible$ 

As you can see, I'm getting a connection timeout error. I tried pinging the server and it seems to be able to communicate with my box.
Not sure what else I could try.

thanks.

EDIT 1

I am behind a proxy. I ran this command to identify my proxy server:

me@mydev:~/Documents/ansible$ export http_proxy=http://10.20.30.40:8080

and then to test, I ran:

sudo apt-get update

and it ran fine.

Best Answer

I added the -E switch to my sudo command and it worked. Try:

sudo -E apt-add-repository ppa:ansible/ansible

This moves (or copies) your environment variables, including http_proxy into the sudo context.

Related Question