cisco.ios.ios_config failing for dhcp snooping

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.

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…