ok, so I changed code to:
`
- name: trunk ports 41,42,48
ios_l2_interfaces:
config:
- name: GigabitEthernet1/0/41
trunk:
allowed_vlans: 10,15
native_vlan: 10
pruning_vlans: 15
encapsulation: dot1q
state: replaced
`
and now get the error
`
{
“module_stdout”: “”,
“module_stderr”: “Traceback (most recent call last):\n File "/var/lib/awx/.ansible/tmp/ansible-local-18974ocs46j5t/ansible-tmp-1596503556.3771946-19096-91595766251735/AnsiballZ_ios_l2_interfaces.py", line 102, in \n _ansiballz_main()\n File "/var/lib/awx/.ansible/tmp/ansible-local-18974ocs46j5t/ansible-tmp-1596503556.3771946-19096-91595766251735/AnsiballZ_ios_l2_interfaces.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/var/lib/awx/.ansible/tmp/ansible-local-18974ocs46j5t/ansible-tmp-1596503556.3771946-19096-91595766251735/AnsiballZ_ios_l2_interfaces.py", line 40, in invoke_module\n runpy.run_module(mod_name=‘ansible.modules.network.ios.ios_l2_interfaces’, init_globals=None, run_name=‘main’, alter_sys=True)\n File "/usr/lib64/python3.6/runpy.py", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code\n exec(code, run_globals)\n File "/tmp/ansible_ios_l2_interfaces_payload__qk3hnqu/ansible_ios_l2_interfaces_payload.zip/ansible/modules/network/ios/ios_l2_interfaces.py", line 364, in \n File "/tmp/ansible_ios_l2_interfaces_payload__qk3hnqu/ansible_ios_l2_interfaces_payload.zip/ansible/modules/network/ios/ios_l2_interfaces.py", line 359, in main\n File "/tmp/ansible_ios_l2_interfaces_payload__qk3hnqu/ansible_ios_l2_interfaces_payload.zip/ansible/module_utils/network/ios/config/l2_interfaces/l2_interfaces.py", line 67, in execute_module\n File "/tmp/ansible_ios_l2_interfaces_payload__qk3hnqu/ansible_ios_l2_interfaces_payload.zip/ansible/module_utils/connection.py", line 185, in rpc\nansible.module_utils.connection.ConnectionError: switchport trunk encapsulation dot1q\r\nswitchport trunk encapsulation dot1q\r\n ^\r\n% Invalid input detected at ‘^’ marker.\r\n\r\nCisco2960(config-if)#\n”,
“exception”: “Traceback (most recent call last):\n File "/var/lib/awx/.ansible/tmp/ansible-local-18974ocs46j5t/ansible-tmp-1596503556.3771946-19096-91595766251735/AnsiballZ_ios_l2_interfaces.py", line 102, in \n _ansiballz_main()\n File "/var/lib/awx/.ansible/tmp/ansible-local-18974ocs46j5t/ansible-tmp-1596503556.3771946-19096-91595766251735/AnsiballZ_ios_l2_interfaces.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/var/lib/awx/.ansible/tmp/ansible-local-18974ocs46j5t/ansible-tmp-1596503556.3771946-19096-91595766251735/AnsiballZ_ios_l2_interfaces.py", line 40, in invoke_module\n runpy.run_module(mod_name=‘ansible.modules.network.ios.ios_l2_interfaces’, init_globals=None, run_name=‘main’, alter_sys=True)\n File "/usr/lib64/python3.6/runpy.py", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code\n exec(code, run_globals)\n File "/tmp/ansible_ios_l2_interfaces_payload__qk3hnqu/ansible_ios_l2_interfaces_payload.zip/ansible/modules/network/ios/ios_l2_interfaces.py", line 364, in \n File "/tmp/ansible_ios_l2_interfaces_payload__qk3hnqu/ansible_ios_l2_interfaces_payload.zip/ansible/modules/network/ios/ios_l2_interfaces.py", line 359, in main\n File "/tmp/ansible_ios_l2_interfaces_payload__qk3hnqu/ansible_ios_l2_interfaces_payload.zip/ansible/module_utils/network/ios/config/l2_interfaces/l2_interfaces.py", line 67, in execute_module\n File "/tmp/ansible_ios_l2_interfaces_payload__qk3hnqu/ansible_ios_l2_interfaces_payload.zip/ansible/module_utils/connection.py", line 185, in rpc\nansible.module_utils.connection.ConnectionError: switchport trunk encapsulation dot1q\r\nswitchport trunk encapsulation dot1q\r\n ^\r\n% Invalid input detected at ‘^’ marker.\r\n\r\nCisco2960(config-if)#\n”,
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,
“rc”: 1,
“_ansible_no_log”: false,
“changed”: false
}
`
which makes even less sense to me… I think its saying it doesn’t like the encapsulation dot1q, which is correct and straight out of the docs as well… appreciate any advice as always and I will open up a report once I get to the bottom of this to get the examples fixed as they are plural.
Regards
BIll