Cisco old ios set interface description (no | section filter)

ansible --version
ansible [core 2.15.3]


failed: [SwitchName] (item={'name': 'Gi3/0/1', 'description': 'sample description'}) => {"ansible_loop_var": "item", "changed": false, "item": {"description": "sample description", "name": "Gi3/0/1"}, "msg": "show running-config | section ^interface\r\nshow running-config | section ^interface\r\n                      ^\r\n% Invalid input detected at '^' marker.\r\n\r\nSwitchName#"}
      cisco.ios.ios_interfaces:
        config:
          - name: "{{ item.name }}"
            description: "{{ item.description }}"
      with_items: "{{ interface }}"

old cisco ios dont support “| section”
The cisco.ios.ios_l2_interfaces module has been fixed, but the interface description cannot be set in it. use show run instead of section pipeline ios_l2_interface by trishnaguha · Pull Request #39658 · ansible/ansible · GitHub

I understand that I can use cisco.ios.ios_config or cisco.ios.ios_command but this does not seem to me the best way.
How to correctly set the interface description in the general case for Cisco iOS?

Hi @Lurker, our official support is for for Cisco IOS versions 17.x. Please note that we don’t officially support older IOS versions, which might be the cause of the issue you’re experiencing. For addressing this, utilizing the ios_command or ios_config modules might be the way to go.

2 Likes