Ansible upgrade 2.1: gather

I recently upgraded to ansible 2.1 from 1.9.1 in our development environment. I use virtualenv to install ansible 2.1 using pip. Recently while running the playbook, I got this error:

fatal: [xxxxx-dev.com]: FAILED! => {"changed": false, "failed": true, "msg": "unsupported parameter for module: gather_subset"}

I see that in Ansible 2.1, they have added a new capability to gather limited facts about hosts but by default it sets gather_subset to all. Thus, I have not set this value in my config file and expect it to default to all.

This failure happened only once and the subsequent runs were successful. I also read here that if ansible is installed separately through apt as well, it may cause issues but since I'm using venv, I'd assume that it will be forced to use version 2.1. Any help is appreciated.


After struggling for two days, I finally understand why it was failing.

The reason was that I had a default configuration setting in ansible.cfg that was making ansible pick up system ansible libraries from /usr/share/ansible instead of virtualenv where we were installing the libraries. The system ansible libraries were outdated on the host we were running the playbook on, thus causing failure. I removed the setting to ensure ansible picks up latest modules installed in venv only.

链接地址: http://www.djcxy.com/p/35446.html

上一篇: 将JSON对象数组转换为关联数组

下一篇: Ansible升级2.1:收集