Skip to content

Backup does not work (the whole config module) #9

@mowgli

Description

@mowgli

Currently I struggle to get the modules to work.

First of all, to have something to compare to, I made the backup with the old Cloudengine module:

  tasks:
    - name: Backup huawei
      community.network.ce_config:
        backup: true
        backup_options:
          filename: "{{ inventory_hostname }}.conf"

This works pretty well with network os set to community.network.ce. But it is only the backup that is working as if system-view is needed, it breaks. (Easy fixable but unmaintained code.

So huawei recommend to use this module and I gave it a try. Unfortunately unsuccessful in all aspects until now.

Here are some errors which I stumble on. later I will report some changes to the docu part that at least it can be viewed.

With the following snipped:

  tasks:
    - name: Backup huawei
      huaweidatacom.ne.ne_config:
        backup: true
        local_file: "{{ inventory_hostname }}.conf"
        local_file_path: backup

… and network os set to huaweidatacom.ne.ne, I get the following error:

TASK [Backup huawei] *******************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'regex'
fatal: [hl-1-h]: FAILED! => {"msg": "Unexpected failure during module execution: No module named 'regex'", "stdout": ""}

When using community.network.ce as network setting (which is, except the use of r'…' instead of br'…' identical to the one in huaweidatacom.ne.ne) I get the following error:

TASK [Backup huawei] *******************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'ansible.module_utils.common.yaml'
fatal: [hl-1-h]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_wx7pm1ew/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/module_utils/network/ne/ne.py\", line 40, in <module>\nImportError: cannot import name 'display' from '__main__' (/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_wx7pm1ew/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/modules/ne_config.py)\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/home/ethgen/.ansible/tmp/ansible-local-399097w77wrt/ansible-tmp-1744717171.0218625-4005-45067270456834/AnsiballZ_ne_config.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/ethgen/.ansible/tmp/ansible-local-399097w77wrt/ansible-tmp-1744717171.0218625-4005-45067270456834/AnsiballZ_ne_config.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/ethgen/.ansible/tmp/ansible-local-399097w77wrt/ansible-tmp-1744717171.0218625-4005-45067270456834/AnsiballZ_ne_config.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.huaweidatacom.ne.plugins.modules.ne_config', init_globals=dict(_module_fqn='ansible_collections.huaweidatacom.ne.plugins.modules.ne_config', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_wx7pm1ew/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/modules/ne_config.py\", line 253, in <module>\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_wx7pm1ew/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/module_utils/network/ne/ne.py\", line 42, in <module>\n  File \"/usr/lib/python3/dist-packages/ansible/utils/display.py\", line 49, in <module>\n    from ansible import constants as C\n  File \"/usr/lib/python3/dist-packages/ansible/constants.py\", line 12, in <module>\n    from ansible.config.manager import ConfigManager\n  File \"/usr/lib/python3/dist-packages/ansible/config/manager.py\", line 21, in <module>\n    from ansible.module_utils.common.yaml import yaml_load\nModuleNotFoundError: No module named 'ansible.module_utils.common.yaml'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

For your information, I used the modules installed via ansible-galaxy collection install huaweidatacom.ne.

If I patch the module with the latest upstream (from ansible.module_utils.common.yaml import yaml_load), I get a different error:

TASK [Backup huawei] *******************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: bad escape \V at position 13
fatal: [hl-1-h]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/ethgen/.ansible/tmp/ansible-local-7476ryt7ia5y/ansible-tmp-1744718335.4013011-7491-198063315622944/AnsiballZ_ne_config.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/ethgen/.ansible/tmp/ansible-local-7476ryt7ia5y/ansible-tmp-1744718335.4013011-7491-198063315622944/AnsiballZ_ne_config.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/ethgen/.ansible/tmp/ansible-local-7476ryt7ia5y/ansible-tmp-1744718335.4013011-7491-198063315622944/AnsiballZ_ne_config.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.huaweidatacom.ne.plugins.modules.ne_config', init_globals=dict(_module_fqn='ansible_collections.huaweidatacom.ne.plugins.modules.ne_config', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_ldtjwk0y/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/modules/ne_config.py\", line 637, in <module>\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_ldtjwk0y/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/modules/ne_config.py\", line 581, in main\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_ldtjwk0y/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/modules/ne_config.py\", line 357, in backup_config\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_ldtjwk0y/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/module_utils/network/ne/ne.py\", line 277, in run_commands\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_ldtjwk0y/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/module_utils/network/ne/ne.py\", line 94, in get_connection\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_ldtjwk0y/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible_collections/huaweidatacom/ne/plugins/module_utils/network/ne/ne.py\", line 110, in get_capabilities\n  File \"/tmp/ethgen/ansible_huaweidatacom.ne.ne_config_payload_ldtjwk0y/ansible_huaweidatacom.ne.ne_config_payload.zip/ansible/module_utils/connection.py\", line 200, in __rpc__\nansible.module_utils.connection.ConnectionError: bad escape \\V at position 13\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

Currently there is nothing from this repository I get working until now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions