How can ios galaxy modules be used to perform L3 configuration?
The use of cisco.ios.ios_l3_interfaces requires that the interface is already in routed mode. (If this is not the case, the module will abort with an error message).
A solution I could find looks like this:
- hosts: Cat9500
tasks:
- name: Changing port mode to switchport
cisco.ios.ios_config:
lines:
- no switchport
parents: interface GigabitEthernet1/0/48
- name: Configure IP address
cisco.ios.ios_l3_interfaces:
config:
- name: GigabitEthernet1/0/48
ipv4:
- address: 192.168.10.2/30
state: replaced
However, it has the problem that the ios_config module is required.
From the theory it should be possible to work with the specific modules without needing the config module.
This is especially problematic because the config module is not (always) idempotent and thus breaks Ansible's implementation logic (check first and change only if needed: result OK or Changed).
For NX-OS the problem has been solved. The module cisco.nxos.nxos_interfaces accepts an attribute 'mode: layer3' to switch to routed mode.
Is there a way to work exclusively with the specific modules for ios (cisco.ios.ios_interfaces and cisco.ios.ios_l3_interfaces) to perform a L3 configuration?
Or is this a missing feature?