在ubuntu上安装ansible

我正在按照此文档安装ansible: https ://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-ubuntu-14-04

我试着在我的ubuntu存储库列表中添加ansible,但这是发生的事情:

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$ 

我也尝试过克隆repo(遵循这些说明: http : //docs.ansible.com/ansible/intro_installation.html )但是失败了以下内容:

 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$ 

如您所见,我收到连接超时错误。 我试着ping服务器,它似乎能够与我的盒子通信。 不确定我还能尝试什么。

谢谢。

编辑1

我是代理人的背后。 我运行此命令来识别我的代理服务器:

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

然后去测试,我跑了:

 sudo apt-get update 

它运行正常。

要么在启动板上有问题,要么您遇到连接问题。 它添加没有问题:

 $sudo apt-add-repository ppa:ansible/ansible [sudo] password for rinzwind: Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems. http://ansible.com/ More info: https://launchpad.net/~ansible/+archive/ubuntu/ansible Press [ENTER] to continue or ctrl-c to cancel adding it gpg: keyring `/tmp/tmpjhg3_1oq/secring.gpg' created gpg: keyring `/tmp/tmpjhg3_1oq/pubring.gpg' created gpg: requesting key 7BB9C367 from hkp server keyserver.ubuntu.com gpg: /tmp/tmpjhg3_1oq/trustdb.gpg: trustdb created gpg: key 7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK 

我添加了-E开关到我的sudo命令,它工作。 尝试:

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

这会将您的环境变量(包括http_proxy )移动(或复制)到sudo上下文中。

我遇到了同样的问题,以下内容对我有用。

 # Make sure the source list directory exists sudo mkdir -p /etc/apt/sources.list.d # Adde the Ansible sources. echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu wily main" | sudo tee -a /etc/apt/sources.list.d/ansible.list echo "deb-src http://ppa.launchpad.net/ansible/ansible/ubuntu wily main" | sudo tee -a /etc/apt/sources.list.d/ansible.list # Install Ansible sudo apt-get update sudo apt-get install ansible 

如果您正在使用另一个版本,则可能需要更改wily才能匹配。 检查Ansible Launchpad页面 。

您的PROXY和防火墙可能不允许您通过SSH连接。

您可以尝试使用HTTPS最常用的防火墙和代理协议:

 git clone https://github.com/ansible/ansible.git --recursive