当我运行 ansible 命令时,如下所示:
ansible -i host all -m ping
我收到以下警告:
[WARNING]: Skipping plugin (/usr/lib/python2.7/dist-packages/ansible/plugins/callback/foreman.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string
within a str or unicode or bytearray object
[WARNING]: Skipping plugin (/usr/lib/python2.7/dist-packages/ansible/plugins/callback/grafana_annotations.py) as it seems to be invalid: from_buffer() cannot return the address of the
raw string within a str or unicode or bytearray object
[WARNING]: Skipping plugin (/usr/lib/python2.7/dist-packages/ansible/plugins/callback/hipchat.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string
within a str or unicode or bytearray object
[WARNING]: Skipping plugin (/usr/lib/python2.7/dist-packages/ansible/plugins/callback/nrdp.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string
within a str or unicode or bytearray object
[WARNING]: Skipping plugin (/usr/lib/python2.7/dist-packages/ansible/plugins/callback/slack.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string
within a str or unicode or bytearray object
[WARNING]: Skipping plugin (/usr/lib/python2.7/dist-packages/ansible/plugins/callback/splunk.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string
within a str or unicode or bytearray object
[WARNING]: Skipping plugin (/usr/lib/python2.7/dist-packages/ansible/plugins/callback/sumologic.py) as it seems to be invalid: from_buffer() cannot return the address of the raw string
within a str or unicode or bytearray object
为什么会发生这种情况?我该如何消除此警告?
服务器参数:
ansible 版本 - 2.9
操作系统版本 - Ubuntu 16.04
答案1
这看起来像是 Python 2 的弃用。
ansible --version
如果你得到
python version = 2.x.x (…)
您应该将 ansible 运行时更改为 Python 3。
更改 ansible 运行时相当复杂,更安全的做法是将操作系统升级到仅支持 Python 3 的版本。但是如果你需要使用任何其他依赖 Python2 的软件,这也可能很困难。