Well, I figured out how to have commas in the config command. Rather than having the 'lines:' variable being a string, have it be a list with the first entry being the config command:
- name: Issue out dhcp snooping config info cisco.ios.ios_config: lines: - ip dhcp snooping vlan 666,684,784 register: commandOutput But this still does not explain why I could issue the one vlan or range of vlans as a single line.... On Wednesday, October 13, 2021 at 3:04:29 PM UTC-4 James Madill wrote: > Help. > > I am receiving a seemingly odd error when trying to assign multiple > non-contiguous VLANs using the cisco ios_config module (latest). Below is > the playbook. > > It runs just fine if there is only one vlan listed, or if there is a range > listed (both with a space between them and a hyphen). But the moment > Ansible sees that first comma, the job blows up. > > > ---------------- > > --- > - name: apply dhcp snooping info to switch > hosts: HOCK-2ND-MGMT-9300-LAB > gather_facts: false > > vars: > ansible_connection: network_cli > ansible_network_os: ios > > tasks: > - name: Install cisco.ios collection > command: ansible-galaxy collection install cisco.ios > > - name: Issue out dhcp snooping config info > cisco.ios.ios_config: > lines: ip dhcp snooping vlan 666,684,784 > register: commandOutput > > > *The error returned:* > > "Traceback (most recent call last): > File > \"/var/lib/awx/.ansible/tmp/ansible-local-3pDz18O/ansible-tmp-1634130678.59-59-19867291292074/AnsiballZ_ios_config.py\", > > line 102, in <module> > _ansiballz_main() > File > \"/var/lib/awx/.ansible/tmp/ansible-local-3pDz18O/ansible-tmp-1634130678.59-59-19867291292074/AnsiballZ_ios_config.py\", > > line 94, in _ansiballz_main > invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) > File > \"/var/lib/awx/.ansible/tmp/ansible-local-3pDz18O/ansible-tmp-1634130678.59-59-19867291292074/AnsiballZ_ios_config.py\", > > line 40, in invoke_module > runpy.run_module(mod_name='ansible_collections.cisco.ios.plugins.modules.ios_config', > > init_globals=None, run_name='__main__', alter_sys=True) > File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module > fname, loader, pkg_name) > File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code > mod_name, mod_fname, mod_loader, pkg_name) > File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code > exec code in run_globals > File > \"/tmp/ansible_cisco.ios.ios_config_payload_ozTcEL/ansible_cisco.ios.ios_config_payload.zip/ansible_collections/cisco/ios/plugins/modules/ios_config.py\", > > line 602, in <module> > File > \"/tmp/ansible_cisco.ios.ios_config_payload_ozTcEL/ansible_cisco.ios.ios_config_payload.zip/ansible_collections/cisco/ios/plugins/modules/ios_config.py\", > > line 511, in main > File > \"/tmp/ansible_cisco.ios.ios_config_payload_ozTcEL/ansible_cisco.ios.ios_config_payload.zip/ansible_collections/cisco/ios/plugins/modules/ios_config.py\", > > line 385, in edit_config_or_macro > File > \"/tmp/ansible_cisco.ios.ios_config_payload_ozTcEL/ansible_cisco.ios.ios_config_payload.zip/ansible/module_utils/connection.py\", > > line 185, in __rpc__ > ansible.module_utils.connection.ConnectionError: 684\r > 684\r > ^\r > % Invalid input detected at '^' marker.\r > > > > > > -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/52417d0f-8208-4334-a51a-b58df86553d4n%40googlegroups.com.