運行以下命令時出現回溯錯誤ansible-playbook -i hosts fmg-playbooks/01_add_model_device.yml我正在運行 Ansible 2.9 和 Python 3.6.5ansible 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 releasewill 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 beremoved 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 不同的版本嗎?
1 回答

躍然一笑
TA貢獻1826條經驗 獲得超6個贊
Python 版本沒問題。事實證明這是端口的問題。我在我的主機文件中切換到 443,它開始工作了。
[FMG:vars]
ansible_network_os = fortinet.fortimanager.fortimanager
ansible_httpapi_port = 443
ansible_httpapi_use_ssl = True
ansible_httpapi_validate_certs = False
ansible_connection = httpapi
添加回答
舉報
0/150
提交
取消