ansible-collections / community.network

Ansible Community Network Collection
http://galaxy.ansible.com/community/network
Other
124 stars 90 forks source link

community.network.ce_switchport incorrect work in ansible 2.10.2 #137

Open artemiysp opened 3 years ago

artemiysp commented 3 years ago

Error with module after update from ansible 2.9.6 to 2.10.2. Error with module: community.network.ce_switchport

Error output failed: [10.31.71.61] (item={'interface': '100GE1/0/1', 'trunk_vlans': '252,253,254,255,149'}) => {"ansible_loop_var": "item", "changed": false, "item": {"interface": "100GE1/0/1", "trunk_vlans": "252,253,254,255,149"}, "module_stderr": "Traceback (most recent call last):\n File \"/home/artemiy/.ansible/tmp/ansible-local-42624rv38a1vw/ansible-tmp-1603621187.0906644-43168-44873429657680/AnsiballZ_ce_switchport.py\", line 102, in \n _ansiballz_main()\n File \"/home/artemiy/.ansible/tmp/ansible-local-42624rv38a1vw/ansible-tmp-1603621187.0906644-43168-44873429657680/AnsiballZ_ce_switchport.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/artemiy/.ansible/tmp/ansible-local-42624rv38a1vw/ansible-tmp-1603621187.0906644-43168-44873429657680/AnsiballZ_ce_switchport.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.network.plugins.modules.ce_switchport', 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_community.network.ce_switchport_payload_k94s148v/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 997, in \n File \"/tmp/ansible_community.network.ce_switchport_payload_k94s148v/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 992, in main\n File \"/tmp/ansible_community.network.ce_switchport_payload_k94s148v/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 338, in init\nKeyError: 'host'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1} An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'host'

How to fix error: Comment 3 lines: at "ce_switchport.py":

host info

    #self.host = self.module.params['host']
    #self.username = self.module.params['username']
    #self.port = self.module.params['port']

(lines 338 - 340) /home/artemiy/.ansible/collections/ansible_collections/community/network/plugins/modules/network/cloudengine/ce_switchport.py

felixfontein commented 3 years ago

CC @QijunPan

ansibullbot commented 3 years ago

@artemiysp: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

Please set the description of this issue with this template: https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE/bug_report.md

click here for bot help

artemiysp commented 3 years ago

Hello.

• ansible version

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

• component name

/home/artemiy/.ansible/collections/ansible_collections

Collection Version


community.network 1.2.0
artemiy@ansible02:~/project04$


name: 🐛 Bug report about: Bug after migrate from module ce_switchport to community.network.ce_switchport

SUMMARY

After upgrade from ansible 2.9.6 to 2.10.2, I start migrate from module «ce*» to «community.network.ce*» 1 module run with error: community.network.ce_switchport

PLAY [?????????? VRF ????????? Huawei] ***

TASK [ce_interface_trunk : ????????? Trunk] ** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'host' failed: [10.31.71.64] (item={'interface': '10GE1/0/21', 'trunk_vlans': '252-253'}) => {"ansible_loop_var": "item", "changed": false, "item": {"interface": "10GE1/0/21", "trunk_vlans": "252-253"}, "module_stderr": "Traceback (most recent call last):\n File \"/home/artemiy/.ansible/tmp/ansible-local-77503wf2uv48s/ansible-tmp-1603641023.6846008-77507-158520318945482/AnsiballZ_ce_switchport.py\", line 102, in \n _ansiballz_main()\n File \"/home/artemiy/.ansible/tmp/ansible-local-77503wf2uv48s/ansible-tmp-1603641023.6846008-77507-158520318945482/AnsiballZ_ce_switchport.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/artemiy/.ansible/tmp/ansible-local-77503wf2uv48s/ansible-tmp-1603641023.6846008-77507-158520318945482/AnsiballZ_ce_switchport.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.network.plugins.modules.ce_switchport', 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_community.network.ce_switchport_payload_h4wf133w/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 997, in \n File \"/tmp/ansible_community.network.ce_switchport_payload_h4wf133w/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 992, in main\n File \"/tmp/ansible_community.network.ce_switchport_payload_h4wf133w/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 338, in init\nKeyError: 'host'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *** 10.31.71.64 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

ISSUE TYPE
How to solve variant 1: self.host = self.module.params.get(‘host’,’') self.username = self.module.params.get(‘username’,’') self.port = self.module.params.get(‘port’,’') How to solve variant 2: # host info #self.host = self.module.params['host'] #self.username = self.module.params['username'] #self.port = self.module.params['port']

=== DEBUG output === artemiy@ansible02:~/project04$ ./run ansible-playbook 2.10.2 config file = /home/artemiy/project04/ansible.cfg configured module search path = ['/home/artemiy/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/artemiy/.local/lib/python3.8/site-packages/ansible executable location = /home/artemiy/.local/bin/ansible-playbook python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] Using /home/artemiy/project04/ansible.cfg as config file setting up inventory plugins host_list declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method script declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method auto declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method yaml declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method Parsed /home/artemiy/project04/inven2.ini inventory source with ini plugin Loading collection community.network from /home/artemiy/.ansible/collections/ansible_collections/community/network Loading callback plugin default of type stdout, v2.0 from /home/artemiy/.local/lib/python3.8/site-packages/ansible/plugins/callback/default.py

PLAYBOOK: test_ce.yaml *** Positional arguments: test_ce.yaml verbosity: 4 connection: smart timeout: 10 become_method: sudo tags: ('all',) inventory: ('/home/artemiy/project04/inven2.ini',) forks: 5 1 plays in test_ce.yaml

PLAY [Добавление VRF Настройка Huawei] *** META: ran handlers

TASK [ce_interface_trunk : Настройка Trunk] ** task path: /home/artemiy/project04/roles/ce_interface_trunk/tasks/main.yml:4 redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf Loading collection ansible.netcommon from /home/artemiy/.ansible/collections/ansible_collections/ansible/netcommon redirecting (type: netconf) ansible.builtin.ce to community.network.ce <10.31.71.64> attempting to start connection <10.31.71.64> using connection plugin ansible.netcommon.netconf Found ansible-connection at path /home/artemiy/.local/bin/ansible-connection <10.31.71.64> local domain socket does not exist, starting it <10.31.71.64> control socket path is /home/artemiy/.ansible/pc/c3c7dd17c3 <10.31.71.64> redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf <10.31.71.64> Loading collection ansible.netcommon from /home/artemiy/.ansible/collections/ansible_collections/ansible/netcommon <10.31.71.64> redirecting (type: netconf) ansible.builtin.ce to community.network.ce <10.31.71.64> Loading collection community.network from /home/artemiy/.ansible/collections/ansible_collections/community/network <10.31.71.64> local domain socket listeners started successfully <10.31.71.64> loaded netconf plugin ansible_collections.community.network.plugins.netconf.ce from path /home/artemiy/.ansible/collections/ansible_collections/community/network/plugins/netconf/ce.py for network_os ce <10.31.71.64> <10.31.71.64> local domain socket path is /home/artemiy/.ansible/pc/c3c7dd17c3 <10.31.71.64> ESTABLISH LOCAL CONNECTION FOR USER: artemiy <10.31.71.64> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/artemiy/.ansible/tmp/ansible-local-780051aboi85x"&& mkdir "echo /home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971" && echo ansible-tmp-1603641425.3165808-78010-47206849119971="echo /home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971" ) && sleep 0' Using module file /home/artemiy/.ansible/collections/ansible_collections/community/network/plugins/modules/ce_switchport.py <10.31.71.64> PUT /home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/tmpn8gzlflj TO /home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/AnsiballZ_ce_switchport.py <10.31.71.64> EXEC /bin/sh -c 'chmod u+x /home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/ /home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/AnsiballZ_ce_switchport.py && sleep 0' <10.31.71.64> EXEC /bin/sh -c '/usr/bin/python3 /home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/AnsiballZ_ce_switchport.py && sleep 0' <10.31.71.64> EXEC /bin/sh -c 'rm -f -r /home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/AnsiballZ_ce_switchport.py", line 102, in _ansiballz_main() File "/home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/AnsiballZ_ce_switchport.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/AnsiballZ_ce_switchport.py", line 40, in invoke_module runpy.run_module(mod_name='ansible_collections.community.network.plugins.modules.ce_switchport', init_globals=None, run_name='main', alter_sys=True) File "/usr/lib/python3.8/runpy.py", line 207, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/tmp/ansible_community.network.ce_switchport_payload_duxqnwpc/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py", line 997, in File "/tmp/ansible_community.network.ce_switchport_payload_duxqnwpc/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py", line 992, in main File "/tmp/ansible_community.network.ce_switchport_payload_duxqnwpc/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py", line 339, in init KeyError: 'username' failed: [10.31.71.64] (item={'interface': '10GE1/0/21', 'trunk_vlans': 256}) => { "ansible_loop_var": "item", "changed": false, "item": { "interface": "10GE1/0/21", "trunk_vlans": 256 }, "module_stderr": "Traceback (most recent call last):\n File \"/home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/AnsiballZ_ce_switchport.py\", line 102, in \n _ansiballz_main()\n File \"/home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/AnsiballZ_ce_switchport.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/artemiy/.ansible/tmp/ansible-local-780051aboi85x/ansible-tmp-1603641425.3165808-78010-47206849119971/AnsiballZ_ce_switchport.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.network.plugins.modules.ce_switchport', 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_community.network.ce_switchport_payload_duxqnwpc/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 997, in \n File \"/tmp/ansible_community.network.ce_switchport_payload_duxqnwpc/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 992, in main\n File \"/tmp/ansible_community.network.ce_switchport_payload_duxqnwpc/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 339, in init\nKeyError: 'username'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

PLAY RECAP *** 10.31.71.64 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

COMPONENT NAME

community.network.ce_switchport /home/artemiy/.ansible/collections/ansible_collections/community/network/plugins/modules/network/cloudengine/ce_switchport.py

ANSIBLE VERSION
ansible 2.10.2
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/artemiy/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/artemiy/.local/lib/python3.8/site-packages/ansible
  executable location = /home/artemiy/.local/bin/ansible
  python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0]
CONFIGURATION
artemiy@ansible02:~/project04$ ansible-config dump --only-changed
DEFAULT_HOST_LIST(/home/artemiy/project04/ansible.cfg) = ['/home/artemiy/project04/inven2.ini']
INTERPRETER_PYTHON(/home/artemiy/project04/ansible.cfg) = /usr/bin/python3
artemiy@ansible02:~/project04$ 
OS / ENVIRONMENT

artemiy@ansible02:~/project04$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal artemiy@ansible02:~/project04$

display version Huawei Versatile Routing Platform Software VRP (R) software, Version 8.150 (CE6870EI V200R002C50SPC800) Copyright (C) 2012-2017 Huawei Technologies Co., Ltd. HUAWEI CE6870-48S6CQ-EI uptime is 27 days, 17 hours, 20 minutes Patch Version: V200R002SPH016 CE6870-48S6CQ-EI(Master) 1 : uptime is 27 days, 17 hours, 18 minutes StartupTime 2020/10/20 16:03:43 Memory Size : 4096 M bytes Flash Size : 1024 M bytes CE6870-48S6CQ-EI version information 1. PCB Version : CEM48S6CQP01 VER B 2. MAB Version : 1 3. Board Type : CE6870-48S6CQ-EI 4. CPLD1 Version : 102 5. CPLD2 Version : 102 6. BIOS Version : 386 ##### STEPS TO REPRODUCE 1. Have device with netconf. 2. Enable netconf (install), ncclient 3. Run playbook ```yaml - name: Switchport module test hosts: 10.31.71.64 connection: local gather_facts: no vars: ansible_connection: netconf cli: host: "10.31.71.64" port: "22" username: "ansible" password: "q1q1q1q1" transport: cli tasks: - name: Ensure 10GE1/0/21 is in its default switchport state community.network.ce_switchport: interface: "10GE1/0/21" trunk_vlans: "256" mode: trunk provider: '{{ cli }}' ``` ##### EXPECTED RESULTS 1. We have hardware (Huawei CE_XXXX) 2. Enable netconf. 3. Run Playbook and have error. ##### ACTUAL RESULTS ```paste below artemiy@ansible02:~/project04$ ansible-playbook -vvvv test_ce2.yaml ansible-playbook 2.10.2 config file = /home/artemiy/project04/ansible.cfg configured module search path = ['/home/artemiy/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/artemiy/.local/lib/python3.8/site-packages/ansible executable location = /home/artemiy/.local/bin/ansible-playbook python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] Using /home/artemiy/project04/ansible.cfg as config file setting up inventory plugins host_list declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method script declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method auto declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method yaml declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method Parsed /home/artemiy/project04/inven2.ini inventory source with ini plugin Loading collection community.network from /home/artemiy/.ansible/collections/ansible_collections/community/network Loading callback plugin default of type stdout, v2.0 from /home/artemiy/.local/lib/python3.8/site-packages/ansible/plugins/callback/default.py PLAYBOOK: test_ce2.yaml ************************************************************************************************************************************************************************** Positional arguments: test_ce2.yaml verbosity: 4 connection: smart timeout: 10 become_method: sudo tags: ('all',) inventory: ('/home/artemiy/project04/inven2.ini',) forks: 5 1 plays in test_ce2.yaml PLAY [Switchport module test] ******************************************************************************************************************************************************************** META: ran handlers TASK [Ensure 10GE1/0/21 is in its default switchport state] ************************************************************************************************************************************** task path: /home/artemiy/project04/test_ce2.yaml:15 redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf Loading collection ansible.netcommon from /home/artemiy/.ansible/collections/ansible_collections/ansible/netcommon redirecting (type: netconf) ansible.builtin.ce to community.network.ce <10.31.71.64> attempting to start connection <10.31.71.64> using connection plugin ansible.netcommon.netconf Found ansible-connection at path /home/artemiy/.local/bin/ansible-connection <10.31.71.64> local domain socket does not exist, starting it <10.31.71.64> control socket path is /home/artemiy/.ansible/pc/568f93eeef <10.31.71.64> redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf <10.31.71.64> Loading collection ansible.netcommon from /home/artemiy/.ansible/collections/ansible_collections/ansible/netcommon <10.31.71.64> redirecting (type: netconf) ansible.builtin.ce to community.network.ce <10.31.71.64> Loading collection community.network from /home/artemiy/.ansible/collections/ansible_collections/community/network <10.31.71.64> local domain socket listeners started successfully <10.31.71.64> loaded netconf plugin ansible_collections.community.network.plugins.netconf.ce from path /home/artemiy/.ansible/collections/ansible_collections/community/network/plugins/netconf/ce.py for network_os ce <10.31.71.64> <10.31.71.64> local domain socket path is /home/artemiy/.ansible/pc/568f93eeef [WARNING]: provider is unnecessary when using netconf and will be ignored <10.31.71.64> ESTABLISH LOCAL CONNECTION FOR USER: artemiy <10.31.71.64> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/artemiy/.ansible/tmp/ansible-local-723550epn1teum `"&& mkdir "` echo /home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682 `" && echo ansible-tmp-1605613085.0958397-723554-145637996325682="` echo /home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682 `" ) && sleep 0' Using module file /home/artemiy/.ansible/collections/ansible_collections/community/network/plugins/modules/ce_switchport.py <10.31.71.64> PUT /home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/tmp2c_vhh91 TO /home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/AnsiballZ_ce_switchport.py <10.31.71.64> EXEC /bin/sh -c 'chmod u+x /home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/ /home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/AnsiballZ_ce_switchport.py && sleep 0' <10.31.71.64> EXEC /bin/sh -c '/usr/bin/python3 /home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/AnsiballZ_ce_switchport.py && sleep 0' <10.31.71.64> EXEC /bin/sh -c 'rm -f -r /home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/AnsiballZ_ce_switchport.py", line 102, in _ansiballz_main() File "/home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/AnsiballZ_ce_switchport.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/AnsiballZ_ce_switchport.py", line 40, in invoke_module runpy.run_module(mod_name='ansible_collections.community.network.plugins.modules.ce_switchport', init_globals=None, run_name='__main__', alter_sys=True) File "/usr/lib/python3.8/runpy.py", line 207, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/tmp/ansible_community.network.ce_switchport_payload_d8e8qzc3/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py", line 997, in File "/tmp/ansible_community.network.ce_switchport_payload_d8e8qzc3/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py", line 992, in main File "/tmp/ansible_community.network.ce_switchport_payload_d8e8qzc3/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py", line 338, in __init__ KeyError: 'host' fatal: [10.31.71.64]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/AnsiballZ_ce_switchport.py\", line 102, in \n _ansiballz_main()\n File \"/home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/AnsiballZ_ce_switchport.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/artemiy/.ansible/tmp/ansible-local-723550epn1teum/ansible-tmp-1605613085.0958397-723554-145637996325682/AnsiballZ_ce_switchport.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.network.plugins.modules.ce_switchport', 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_community.network.ce_switchport_payload_d8e8qzc3/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 997, in \n File \"/tmp/ansible_community.network.ce_switchport_payload_d8e8qzc3/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 992, in main\n File \"/tmp/ansible_community.network.ce_switchport_payload_d8e8qzc3/ansible_community.network.ce_switchport_payload.zip/ansible_collections/community/network/plugins/modules/ce_switchport.py\", line 338, in __init__\nKeyError: 'host'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 } PLAY RECAP *************************************************************************************************************************************************************************************** 10.31.71.64 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 artemiy@ansible02:~/project04$ ``` P. S. Debug after change /home/artemiy/.ansible/collections/ansible_collections/community/network/plugins/modules/network/cloudengine/ce_switchport.py line 338-340 From: self.host = self.module.params['host'] self.username = self.module.params['username'] self.port = self.module.params['port'] To: self.host = self.module.params.get('host', '') self.username = self.module.params.get('username', '') self.port = self.module.params.get('port', '') Debug output: artemiy@ansible02:~/project04$ ansible-playbook -vvvv test_ce2.yaml ansible-playbook 2.10.2 config file = /home/artemiy/project04/ansible.cfg configured module search path = ['/home/artemiy/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/artemiy/.local/lib/python3.8/site-packages/ansible executable location = /home/artemiy/.local/bin/ansible-playbook python version = 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] Using /home/artemiy/project04/ansible.cfg as config file setting up inventory plugins host_list declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method script declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method auto declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method yaml declined parsing /home/artemiy/project04/inven2.ini as it did not pass its verify_file() method Parsed /home/artemiy/project04/inven2.ini inventory source with ini plugin Loading collection community.network from /home/artemiy/.ansible/collections/ansible_collections/community/network Loading callback plugin default of type stdout, v2.0 from /home/artemiy/.local/lib/python3.8/site-packages/ansible/plugins/callback/default.py PLAYBOOK: test_ce2.yaml ************************************************************************************************************************************************************************** Positional arguments: test_ce2.yaml verbosity: 4 connection: smart timeout: 10 become_method: sudo tags: ('all',) inventory: ('/home/artemiy/project04/inven2.ini',) forks: 5 1 plays in test_ce2.yaml PLAY [Switchport module test] ******************************************************************************************************************************************************************** META: ran handlers TASK [Ensure 10GE1/0/21 is in its default switchport state] ************************************************************************************************************************************** task path: /home/artemiy/project04/test_ce2.yaml:15 redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf Loading collection ansible.netcommon from /home/artemiy/.ansible/collections/ansible_collections/ansible/netcommon redirecting (type: netconf) ansible.builtin.ce to community.network.ce <10.31.71.64> attempting to start connection <10.31.71.64> using connection plugin ansible.netcommon.netconf Found ansible-connection at path /home/artemiy/.local/bin/ansible-connection <10.31.71.64> local domain socket does not exist, starting it <10.31.71.64> control socket path is /home/artemiy/.ansible/pc/badb29ef28 <10.31.71.64> redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf <10.31.71.64> Loading collection ansible.netcommon from /home/artemiy/.ansible/collections/ansible_collections/ansible/netcommon <10.31.71.64> redirecting (type: netconf) ansible.builtin.ce to community.network.ce <10.31.71.64> Loading collection community.network from /home/artemiy/.ansible/collections/ansible_collections/community/network <10.31.71.64> local domain socket listeners started successfully <10.31.71.64> loaded netconf plugin ansible_collections.community.network.plugins.netconf.ce from path /home/artemiy/.ansible/collections/ansible_collections/community/network/plugins/netconf/ce.py for network_os ce <10.31.71.64> <10.31.71.64> local domain socket path is /home/artemiy/.ansible/pc/badb29ef28 [WARNING]: provider is unnecessary when using netconf and will be ignored <10.31.71.64> ESTABLISH LOCAL CONNECTION FOR USER: artemiy <10.31.71.64> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/artemiy/.ansible/tmp/ansible-local-7237442awifyfr `"&& mkdir "` echo /home/artemiy/.ansible/tmp/ansible-local-7237442awifyfr/ansible-tmp-1605613397.2579367-723748-123377662491949 `" && echo ansible-tmp-1605613397.2579367-723748-123377662491949="` echo /home/artemiy/.ansible/tmp/ansible-local-7237442awifyfr/ansible-tmp-1605613397.2579367-723748-123377662491949 `" ) && sleep 0' Using module file /home/artemiy/.ansible/collections/ansible_collections/community/network/plugins/modules/ce_switchport.py <10.31.71.64> PUT /home/artemiy/.ansible/tmp/ansible-local-7237442awifyfr/tmph9vk9l56 TO /home/artemiy/.ansible/tmp/ansible-local-7237442awifyfr/ansible-tmp-1605613397.2579367-723748-123377662491949/AnsiballZ_ce_switchport.py <10.31.71.64> EXEC /bin/sh -c 'chmod u+x /home/artemiy/.ansible/tmp/ansible-local-7237442awifyfr/ansible-tmp-1605613397.2579367-723748-123377662491949/ /home/artemiy/.ansible/tmp/ansible-local-7237442awifyfr/ansible-tmp-1605613397.2579367-723748-123377662491949/AnsiballZ_ce_switchport.py && sleep 0' <10.31.71.64> EXEC /bin/sh -c '/usr/bin/python3 /home/artemiy/.ansible/tmp/ansible-local-7237442awifyfr/ansible-tmp-1605613397.2579367-723748-123377662491949/AnsiballZ_ce_switchport.py && sleep 0' <10.31.71.64> EXEC /bin/sh -c 'rm -f -r /home/artemiy/.ansible/tmp/ansible-local-7237442awifyfr/ansible-tmp-1605613397.2579367-723748-123377662491949/ > /dev/null 2>&1 && sleep 0' ok: [10.31.71.64] => { "changed": false, "end_state": { "interface": "10GE1/0/21", "mode": "trunk", "switchport": "enable", "trunk_pvid": "1", "trunk_vlans": "40000000000000000000000000000000000000000000000000EECEECFFFFFCCC8E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044000CC000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, "existing": { "interface": "10GE1/0/21", "mode": "trunk", "switchport": "enable", "trunk_pvid": "1", "trunk_vlans": "40000000000000000000000000000000000000000000000000EECEECFFFFFCCC8E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044000CC000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }, "invocation": { "module_args": { "default_vlan": null, "interface": "10GE1/0/21", "mode": "trunk", "provider": null, "pvid_vlan": null, "state": "present", "tagged_vlans": null, "trunk_vlans": "256", "untagged_vlans": null } }, "proposed": { "interface": "10GE1/0/21", "mode": "trunk", "pvid_vlan": null, "state": "present", "trunk_vlans": "256" }, "updates": [] } META: ran handlers META: ran handlers PLAY RECAP *************************************************************************************************************************************************************************************** 10.31.71.64 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 artemiy@ansible02:~/project04$ -- Best regards Artemiy Tsopov Senior Network Engineer CCDA, CCNP R&S, CCNP Security, CCIP, HCIE Jet Infosystems tel.: +7 (495) 411-7601 (ext.1216) fax: +7 (495) 411-7602 mobile tel. +7-903-739-78-56 mobile tel +7-916-140-05-90 email: tsopovaa@jet.su > 16 нояб. 2020 г., в 21:05, Ansibullbot manages ticket workflow написал(а): > > > @artemiysp: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information. > > Here are the items we could not find in your description: > > • ansible version > • component name > Please set the description of this issue with this template: > https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE/bug_report.md > > click here for bot help > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub, or unsubscribe. >
ansibullbot commented 2 years ago

cc @TommyLike @edisonxiang @freesky-edward @hwDCN @niuzhenguo @xuxiaowei0512 @yanzhangi @zengchen1024 @zhongjun2 click here for bot help