运行以下命令时出现回溯错误
ansible-playbook -i hosts fmg-playbooks/01_add_model_device.yml
我正在运行 Ansible 2.9 和 Python 3.6.5
ansible 2.9.11
config file = /home/alice/ansible/ansible.cfg
configured module search path = ['/home/alice/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.5 (default, Apr 1 2018, 05:46:30) [GCC 7.3.0]
我收到有关 Python 版本的警告
TASK [Gathering Facts] ***************************************************************************************************************************************************************************************
[DEPRECATION WARNING]: Distribution Ubuntu 18.04 on host fmg01 should use /usr/bin/python3, but is using /usr/bin/python for backward compatibility with prior Ansible releases. A future Ansible release
will default to using the discovered platform python for this host. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information. This feature will be
removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
ok: [fmg01]
然后当我尝试添加设备时,出现回溯错误
TASK [Add model device] **************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: Method not found
这可能是 Ansible 使用错误的 Python 解释器的问题吗?我可以强制它使用与 2.7 不同的版本吗?
跃然一笑
相关分类