尝试在服务器上安装 ansible 1.9。我已经安装了 ansible-1.9 PPA。以下是我上次尝试的相关信息:
root@host:/etc/apt/sources.list.d# ll
total 60
drwxr-xr-x 2 root root 4096 Aug 26 13:44 ./
drwxr-xr-x 6 root root 4096 Aug 26 13:40 ../
-rw-r--r-- 1 root root 142 Aug 26 13:40 ansible-ansible-1_9-trusty.list
-rw-r--r-- 1 root root 87 Aug 26 13:40 deb_thehost_org.list
-rw-r--r-- 1 root root 87 Aug 26 10:32 deb_thehost_org.list.save
-rw-r--r-- 1 root root 69 Aug 26 13:40 mirrors_dev_company_com_java_java_ubuntu.list
-rw-r--r-- 1 root root 69 Aug 26 10:32 mirrors_dev_company_com_java_java_ubuntu.list.save
-rw-r--r-- 1 root root 70 Aug 26 13:40 mirrors_dev_company_com_zabbix_3_0_ubuntu.list
-rw-r--r-- 1 root root 70 Aug 26 10:32 mirrors_dev_company_com_zabbix_3_0_ubuntu.list.save
-rw-r--r-- 1 root root 75 Aug 26 13:40 packages_elasticsearch_org_logstashforwarder_debian.list
-rw-r--r-- 1 root root 75 Aug 26 10:32 packages_elasticsearch_org_logstashforwarder_debian.list.save
-rw-r--r-- 1 root root 377 Aug 26 13:40 puppetlabs-pc1.list
-rw-r--r-- 1 root root 377 Aug 26 10:32 puppetlabs-pc1.list.save
-rw-r--r-- 1 root root 40 Aug 26 13:40 repo_dev_company_com.list
-rw-r--r-- 1 root root 40 Aug 26 10:32 repo_dev_company_com.list.save
root@host:/etc/apt/sources.list.d# apt-cache madison ansible
ansible | 1.9.6-1ppa~trusty | http://ppa.launchpad.net/ansible/ansible-1.9/ubuntu/ trusty/main amd64 Packages
ansible | 1.7.2+dfsg-1~ubuntu14.04.1 | https://mirrors.dev.company.com/ubuntu/ trusty-backports/universe amd64 Packages
ansible | 1.5.4+dfsg-1 | https://mirrors.dev.company.com/ubuntu/ trusty/universe amd64 Packages
ansible | 1.5.4+dfsg-1 | https://mirrors.dev.company.com/ubuntu/ trusty/universe Sources
ansible | 1.7.2+dfsg-1~ubuntu14.04.1 | https://mirrors.dev.company.com/ubuntu/ trusty-backports/universe Sources
root@host:/etc/apt/sources.list.d# apt-get install ansible=1.9.6-1ppa~trusty --dry-run
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
python-crypto python-httplib2 python-jinja2 python-markupsafe
python-paramiko python-support sshpass
Suggested packages:
python-crypto-dbg python-crypto-doc python-jinja2-doc
The following NEW packages will be installed:
ansible python-crypto python-httplib2 python-jinja2 python-markupsafe
python-paramiko python-support sshpass
0 upgraded, 8 newly installed, 0 to remove and 8 not upgraded.
Inst python-support (1.0.15 Ubuntu:14.04/trusty [all])
Inst python-markupsafe (0.18-1build2 Ubuntu:14.04/trusty [amd64])
Inst python-jinja2 (2.7.2-2 Ubuntu:14.04/trusty [all])
Inst python-crypto (2.6.1-4build1 Ubuntu:14.04/trusty [amd64])
Inst python-paramiko (1.10.1-1git1build1 Ubuntu:14.04/trusty [all])
Inst python-httplib2 (0.8-2build1 Ubuntu:14.04/trusty [all])
Inst sshpass (1.05-1 Ubuntu:14.04/trusty [amd64])
Inst ansible (1.9.6-1ppa~trusty ansible-1.9:14.04/trusty [all])
Conf python-support (1.0.15 Ubuntu:14.04/trusty [all])
Conf python-markupsafe (0.18-1build2 Ubuntu:14.04/trusty [amd64])
Conf python-jinja2 (2.7.2-2 Ubuntu:14.04/trusty [all])
Conf python-crypto (2.6.1-4build1 Ubuntu:14.04/trusty [amd64])
Conf python-paramiko (1.10.1-1git1build1 Ubuntu:14.04/trusty [all])
Conf python-httplib2 (0.8-2build1 Ubuntu:14.04/trusty [all])
Conf sshpass (1.05-1 Ubuntu:14.04/trusty [amd64])
Conf ansible (1.9.6-1ppa~trusty ansible-1.9:14.04/trusty [all])
root@host:/etc/apt/sources.list.d# apt-get install ansible=1.9.6-1ppa~trusty
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
python-crypto python-httplib2 python-jinja2 python-markupsafe
python-paramiko python-support sshpass
Suggested packages:
python-crypto-dbg python-crypto-doc python-jinja2-doc
The following NEW packages will be installed:
ansible python-crypto python-httplib2 python-jinja2 python-markupsafe
python-paramiko python-support sshpass
0 upgraded, 8 newly installed, 0 to remove and 8 not upgraded.
Need to get 0 B/1,235 kB of archives.
After this operation, 7,827 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package python-support.
(Reading database ... 124674 files and directories currently installed.)
...
Setting up ansible (1.9.6-1ppa~trusty) ...
Processing triggers for python-support (1.0.15) ...
root@host:/etc/apt/sources.list.d# ansible --version
ansible 2.1.1.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
我遗漏了什么?这是 Ansible PPA 的问题吗,还是我错过了某个步骤?
答案1
问题原来是之前(无意的)安装 2.1.1.0 时遗留的垃圾,没有用“apt-get purge”删除。遇到此问题的其他任何人应检查:/usr/local/bin 和 /usr/local/lib/python2.7/dist-packages 中是否有任何与 ansible 相关的后清除内容。我能够通过启动全新的 Ubuntu 实例来安装正确的版本,但如果您清除任何可能遗留的内容,您应该不会遇到任何问题。