community.network
community.network copied to clipboard
community.network.ce_config: unindent does not match any outer indentation level
SUMMARY
I want to configure a huawei switch according to the ansible doc of community.network.ce_config. The task is:
- name: "Configure top level configuration and save it" community.network.ce_config: lines: "sysname switchname"
This throws an error.
ISSUE TYPE
TASK [Configure top level configuration and save it] **************************************************************************************
task path: /home/misch/huawei_configure.yml:38
The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 158, in run
res = self._execute()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 629, in _execute
result = self._handler.run(task_vars=vars_copy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/community/network/plugins/action/ce.py", line 56, in run
result = super(ActionModule, self).run(task_vars=task_vars)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon/plugins/action/network.py", line 42, in run
filename, module = self._find_load_module()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon/plugins/action/network.py", line 280, in _find_load_module
module = importlib.import_module(context.plugin_resolved_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
COMPONENT NAME
community.network.ce_config
ANSIBLE VERSION
ansible [core 2.14.2]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/misch/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.11/site-packages/ansible
ansible collection location = /home/misch/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.11.2 (main, May 24 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11)
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
# /usr/lib/python3.11/site-packages/ansible_collections
Collection Version
----------------- -------
community.network 5.0.0
CONFIGURATION
$ ansible-config dump --only-changed
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/netbox-inventory.yml', '/etc/ansible/inventory.yml']
OS / ENVIRONMENT
$ cat /etc/os-release
NAME="AlmaLinux"
VERSION="9.2 (Turquoise Kodkod)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.2 (Turquoise Kodkod)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"
ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.2"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.2"
STEPS TO REPRODUCE
run the task above.
- name: "Configure top level configuration and save it"
community.network.ce_config:
lines: "sysname switchname"
EXPECTED RESULTS
Set hostname on device.
ACTUAL RESULTS
TASK [Configure top level configuration and save it] **************************************************************************************
task path: /home/misch/huawei_configure.yml:38
The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 158, in run
res = self._execute()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 629, in _execute
result = self._handler.run(task_vars=vars_copy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/community/network/plugins/action/ce.py", line 56, in run
result = super(ActionModule, self).run(task_vars=task_vars)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon/plugins/action/network.py", line 42, in run
filename, module = self._find_load_module()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/ansible/netcommon/plugins/action/network.py", line 280, in _find_load_module
module = importlib.import_module(context.plugin_resolved_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "/usr/lib/python3.11/site-packages/ansible/utils/collection_loader/_collection_finder.py", line 432, in exec_module
code_obj = self.get_code(self._fullname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible/utils/collection_loader/_collection_finder.py", line 544, in get_code
self._compiled_code = compile(source=source_code, filename=filename, mode='exec', flags=0, dont_inherit=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/ansible_collections/community/network/plugins/modules/ce_config.py", line 275
if module.params['defaults']:
^
IndentationError: unindent does not match any outer indentation level
fatal: [Ansible-test-22]: FAILED! => {
"msg": "Unexpected failure during module execution: unindent does not match any outer indentation level (ce_config.py, line 275)",
"stdout": ""
}