Vagrant Ansible无法识别deb参数的能力倾向

Vagrant Ansible无法识别deb参数的能力倾向,vagrant,ansible,Vagrant,Ansible,根据,智能模块允许从.deb文件安装: # Install a .deb package - apt: deb=/tmp/mypackage.deb 但在Ubuntu 14.04上运行Ansible 1.9.2或1.8.4时,此配置: - name: install riak apt: deb=/data/riak/riak.deb update_cache=no 生成此输出: TASK: [riak | install riak] ***************************

根据,智能模块允许从.deb文件安装:

# Install a .deb package
- apt: deb=/tmp/mypackage.deb
但在Ubuntu 14.04上运行Ansible 1.9.2或1.8.4时,此配置:

- name: install riak
  apt: deb=/data/riak/riak.deb update_cache=no
生成此输出:

TASK: [riak | install riak] *************************************************** 
failed: [riak-server-1] => {"failed": true}
msg: unsupported parameter for module: deb
同样的Ansible脚本在运行Ansible 1.8.4和1.9的Mac上运行良好

在任何情况下,客人都是ubuntu/trusty64创建的流浪汉。整个VM的创建和安装都是使用Vagrant和Ansible完成的,我们都使用相同的Vagrant/Ansible文件运行

编辑:

它是从以下来源构建的:

>git status
On branch stable-1.9
Your branch is up-to-date with 'origin/stable-1.9'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

    modified:   lib/ansible/module_utils/basic.py
    modified:   lib/ansible/modules/core (modified content)
    modified:   v2/ansible/modules/core (modified content)

>git diff lib/ansible/module_utils/basic.py
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
index 91501b1..3430abe 100644
--- a/lib/ansible/module_utils/basic.py
+++ b/lib/ansible/module_utils/basic.py
@@ -911,7 +911,7 @@ class AnsibleModule(object):
             #if k in ('CHECKMODE', 'NO_LOG'):
             #    continue
             if k not in self._legal_inputs:
-                self.fail_json(msg="unsupported parameter for module: %s" % k)
+                self.fail_json(msg="unsupported parameter for module: %s. supported parameters are %s" % (k, self._legal_inputs))

     def _count_terms(self, check):
         count = 0

TASK: [riak | install riak] *************************************************** 
failed: [riak-server-3] => {"failed": true}
msg: unsupported parameter for module: deb. supported parameters are ['CHECKMODE', 'NO_LOG', 'dpkg_options', 'upgrade', 'force', 'package', 'pkg', 'name', 'purge', 'state', 'update_cache', 'update-cache', 'default_release', 'default-release', 'install_recommends', 'install-recommends', 'cache_valid_time']

嗯,它现在开始工作了。事实证明,ansible在不久前运行
sudo apt get install ansible
时还剩下一部分。所以,即使我试着彻底擦洗所有使用过的ansible碎片

sudo rm -rf /usr/local/lib/python2.7/dist-packages/ansible* /usr/local/bin/ansible* /usr/bin/ansible*
即使我的系统中没有留下旧的apt.py,
sudo apt get remove ansible
找到了要删除的内容。我以为我在沿着源代码路线走之前就已经运行过了,但显然不是

>sudo apt-get remove ansible
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  python-jinja2 python-markupsafe python-yaml
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  ansible
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 2,758 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 282489 files and directories currently installed.)
Removing ansible (1.5.4+dfsg-1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
之后,我重新克隆了源代码:

git clone git@github.com:ansible/ansible --recursive
重建:

sudo make clean install
sudo /bin/bash ./hacking/env-setup
现在,从.deb文件进行安装可以正常工作:

TASK: [riak | install riak] *************************************************** 
changed: [riak-server-3]

这很奇怪。你检查过Ansible的版本了吗?如果有问题的命令是
ansible playbook
,您是否在尝试执行有问题的命令之前立即尝试过
ansible playbook--version
?如果您在virtualenv中运行ansible,请尝试删除并重新安装virtualenv。确实,很奇怪。我已经检查了三倍多,但仍在继续挖掘,因为似乎某个地方一定有一个旧版本。@Antonicschristofides-编辑问题以添加更多信息。@Antonicschristofides-正在工作,记录为答案。
sudo make clean install
sudo /bin/bash ./hacking/env-setup
TASK: [riak | install riak] *************************************************** 
changed: [riak-server-3]