簡體   English   中英

Ansible playbook 停止在新的 Ubuntu 20.04 機器上運行(Ansible 2.10 / Python 3.8.5)

[英]Ansible playbooks stop running on new Ubuntu 20.04 box (Ansible 2.10 / Python 3.8.5)

我的一本劇本在以下設置上運行正常

ansible 2.9.11  config file = None  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]

然而,當我將相同的劇本移動到以下設置時,事情就壞了

ansible 2.10.2
  config file = /home/bob/ansible/ansible.cfg
  configured module search path = ['/home/bob/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]

我收到以下錯誤並試圖確定它是新的 python 版本、Ansible 版本還是 Ansible Galaxy 模塊版本(從 Fortinet.Fortimanager 1.0.5 升級到 2.0.0,但是當我強制安裝 1.0 時.5,我收到另一個錯誤,這讓我認為這不是主要問題)

TASK [Add model device] ******************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible_collections.fortinet.fortimanager.plugins.module_utils.common.FMGBaseException: An attempt was made at communicating with a FMG with no valid session and an unexpected error was discovered.
fatal: [fmg01]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_fmgr_dvm_cmd_add_device_payload_ekiptyph/ansible_fmgr_dvm_cmd_add_device_payload.zip/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dvm_cmd_add_device.py\", line 351, in main\n  File \"/tmp/ansible_fmgr_dvm_cmd_add_device_payload_ekiptyph/ansible_fmgr_dvm_cmd_add_device_payload.zip/ansible/module_utils/connection.py\", line 195, in __rpc__\nansible.module_utils.connection.ConnectionError: An attempt was made at communicating with a FMG with no valid session and an unexpected error was discovered.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/home/bob/.ansible/tmp/ansible-local-12942ssko667z/ansible-tmp-1603819794.3367019-13026-201727037698625/AnsiballZ_fmgr_dvm_cmd_add_device.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/bob/.ansible/tmp/ansible-local-12942ssko667z/ansible-tmp-1603819794.3367019-13026-201727037698625/AnsiballZ_fmgr_dvm_cmd_add_device.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/bob/.ansible/tmp/ansible-local-12942ssko667z/ansible-tmp-1603819794.3367019-13026-201727037698625/AnsiballZ_fmgr_dvm_cmd_add_device.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.fortinet.fortimanager.plugins.modules.fmgr_dvm_cmd_add_device', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_fmgr_dvm_cmd_add_device_payload_ekiptyph/ansible_fmgr_dvm_cmd_add_device_payload.zip/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dvm_cmd_add_device.py\", line 362, in <module>\n  File \"/tmp/ansible_fmgr_dvm_cmd_add_device_payload_ekiptyph/ansible_fmgr_dvm_cmd_add_device_payload.zip/ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_dvm_cmd_add_device.py\", line 356, in main\nansible_collections.fortinet.fortimanager.plugins.module_utils.common.FMGBaseException: An attempt was made at communicating with a FMG with no valid session and an unexpected error was discovered.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

鑒於輸出錯誤,有關如何隔離此問題的任何建議?

這是有問題的劇本(超級簡單)

---
- name: Add model device to FMG and install Policy Package
  hosts: fmg01
  #  gather_facts: no
  connection: httpapi
  collections:
    - fortinet.fortimanager

  tasks:
    - name: Add model device
      fmgr_dvm_cmd_add_device:
        loose_validation: true
        method: exec
        params:
          - data:
              adom: root
              device:
                # device action: add_model
                mgmt_mode: 'fmg'
                #os_ver: 6
                #mr: 4
                sn: FGVM01TMxxxxxxxx
                adm_pass: 'password'
                adm_usr: 'admin'
                ip: '192.168.0.100'

哎呀,問題似乎是 Fortinet Fortimanager 缺少以下項目:

config system admin user
edit admin
set rpc-permit read-write
end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM