<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Ansible L3 Interface Configuration for IOS without cli modules in Controllers</title>
    <link>https://community.cisco.com/t5/controllers/ansible-l3-interface-configuration-for-ios-without-cli-modules/m-p/4766582#M944</link>
    <description>&lt;P&gt;&lt;STRONG&gt;How can ios galaxy modules be used to perform L3 configuration?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The use of cisco.ios.ios_l3_interfaces requires that the interface is already in &lt;FONT color="#FF0000"&gt;routed mode&lt;/FONT&gt;. (If this is not the case, the module will abort with an error message).&lt;/P&gt;
&lt;P&gt;A solution I could find looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;- 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
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, it has the problem that the ios_config module is required.&lt;/P&gt;
&lt;P&gt;From the theory it should be possible to work with the specific modules without needing the config module.&lt;/P&gt;
&lt;P&gt;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).&lt;/P&gt;
&lt;P&gt;For NX-OS the problem has been solved. The module cisco.nxos.nxos_interfaces accepts an attribute 'mode: layer3' to switch to routed mode.&lt;/P&gt;
&lt;P&gt;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?&lt;/P&gt;
&lt;P&gt;Or is this a missing feature?&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2023 10:40:09 GMT</pubDate>
    <dc:creator>networkcon</dc:creator>
    <dc:date>2023-02-01T10:40:09Z</dc:date>
    <item>
      <title>Ansible L3 Interface Configuration for IOS without cli modules</title>
      <link>https://community.cisco.com/t5/controllers/ansible-l3-interface-configuration-for-ios-without-cli-modules/m-p/4766582#M944</link>
      <description>&lt;P&gt;&lt;STRONG&gt;How can ios galaxy modules be used to perform L3 configuration?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The use of cisco.ios.ios_l3_interfaces requires that the interface is already in &lt;FONT color="#FF0000"&gt;routed mode&lt;/FONT&gt;. (If this is not the case, the module will abort with an error message).&lt;/P&gt;
&lt;P&gt;A solution I could find looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;- 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
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, it has the problem that the ios_config module is required.&lt;/P&gt;
&lt;P&gt;From the theory it should be possible to work with the specific modules without needing the config module.&lt;/P&gt;
&lt;P&gt;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).&lt;/P&gt;
&lt;P&gt;For NX-OS the problem has been solved. The module cisco.nxos.nxos_interfaces accepts an attribute 'mode: layer3' to switch to routed mode.&lt;/P&gt;
&lt;P&gt;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?&lt;/P&gt;
&lt;P&gt;Or is this a missing feature?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 10:40:09 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/ansible-l3-interface-configuration-for-ios-without-cli-modules/m-p/4766582#M944</guid>
      <dc:creator>networkcon</dc:creator>
      <dc:date>2023-02-01T10:40:09Z</dc:date>
    </item>
  </channel>
</rss>

