Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iosxr match strict with src broken #11

Open
geordish opened this issue Apr 14, 2020 · 0 comments
Open

iosxr match strict with src broken #11

geordish opened this issue Apr 14, 2020 · 0 comments
Assignees
Milestone

Comments

@geordish
Copy link

SUMMARY

without the 'match' part of the config, the addresses under the interfaces never get applied. I assume it's because there is already the same config line (though different hierarchy) elsewhere in the config.

playing round with the 'match' and 'replace' options give me the error 'match is strict but all of the following are missing: lines' but the docs tell me that src and lines are mutually exclusive.

Match: none does work, however this causes the full configuration to be applied each time, which seems like is defeating the point.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

iosxr_config

ANSIBLE VERSION
ansible 2.9.6
  config file = None
  configured module search path = [u'/home/dave/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/dave/.local/lib/python2.7/site-packages/ansible
  executable location = /home/dave/.local/bin/ansible
  python version = 2.7.17 (default, Nov  7 2019, 10:07:09) [GCC 7.4.0]
CONFIGURATION
Nothing
OS / ENVIRONMENT

Linux ansible 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Cisco IOS XR Software, Version 6.6.3

STEPS TO REPRODUCE
- name: Configure IS-IS on IOS XR
  hosts: all
  connection: network_cli
 
  vars:
    net: 49.0001.0000.0000.0001.00
    interfaces:
      - name: FortyGigE0/0/0/34
        password: qwerty12345
      - name: FortyGigE0/0/0/35
        password: qwerty12345
 
  tasks:
    - name: Configure IS-IS
      iosxr_config:
        src: isis.j2
        match: strict
router isis ISIS
 is-type level-2-only
 net {{ net }}
 lsp-password keychain ISIS_DOMAIN
 address-family ipv4 unicast
  metric-style wide
 
 address-family ipv6 unicast
  metric-style wide
 
 interface Loopback0
  address-family ipv4 unicast
  address-family ipv6 unicast
 
 {% for interface in interfaces %}
 interface {{ interface.name }}
  address-family ipv4 unicast
  address-family ipv6 unicast
  circuit-type level-2-only
  point-to-point
  hello-password hmac-md5 {{ interface.password }}
 
 {% endfor %}
EXPECTED RESULTS

The full configuration should get applied.

ACTUAL RESULTS

With strict:

The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_iosxr_config_payload_ohvbQT/ansible_iosxr_config_payload.zip/ansible/module_utils/basic.py", line 1577, in _check_required_if
    check_required_if(spec, param)
  File "/tmp/ansible_iosxr_config_payload_ohvbQT/ansible_iosxr_config_payload.zip/ansible/module_utils/common/validation.py", line 275, in check_required_if
    raise TypeError(to_native(msg))
fatal: [51.148.78.121]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "admin": false,
            "backup": false,
            "comment": "configured by iosxr_config",
            "exclusive": false,
            "force": false,
            "match": "strict",
            "replace": "line",
            "src": "router isis ISIS\n is-type level-2-only\n net 49.0001.0000.0000.0001.00\n lsp-password keychain ISIS_DOMAIN\n address-family ipv4 unicast\n  metric-style wide\n\n address-family ipv6 unicast\n  metric-style wide\n\n interface Loopback0\n  address-family ipv4 unicast\n  address-family ipv6 unicast\n\n  interface FortyGigE0/0/0/34\n  address-family ipv4 unicast\n  address-family ipv6 unicast\n  circuit-type level-2-only\n  point-to-point\n  hello-password hmac-md5 qwerty12345\n\n  interface FortyGigE0/0/0/35\n  address-family ipv4 unicast\n  address-family ipv6 unicast\n  circuit-type level-2-only\n  point-to-point\n  hello-password hmac-md5 qwerty12345\n\n \n"
        }
    },
    "msg": "match is strict but all of the following are missing: lines"
}

With match: exact:

The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_iosxr_config_payload_tgycVL/ansible_iosxr_config_payload.zip/ansible/module_utils/basic.py", line 1577, in _check_required_if
    check_required_if(spec, param)
  File "/tmp/ansible_iosxr_config_payload_tgycVL/ansible_iosxr_config_payload.zip/ansible/module_utils/common/validation.py", line 275, in check_required_if
    raise TypeError(to_native(msg))
fatal: [51.148.78.121]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "admin": false,
            "backup": false,
            "comment": "configured by iosxr_config",
            "exclusive": false,
            "force": false,
            "match": "exact",
            "replace": "line",
            "src": "router isis ISIS\n is-type level-2-only\n net 49.0001.0000.0000.0001.00\n lsp-password keychain ISIS_DOMAIN\n address-family ipv4 unicast\n  metric-style wide\n\n address-family ipv6 unicast\n  metric-style wide\n\n interface Loopback0\n  address-family ipv4 unicast\n  address-family ipv6 unicast\n\n  interface FortyGigE0/0/0/34\n  address-family ipv4 unicast\n  address-family ipv6 unicast\n  circuit-type level-2-only\n  point-to-point\n  hello-password hmac-md5 qwerty12345\n\n  interface FortyGigE0/0/0/35\n  address-family ipv4 unicast\n  address-family ipv6 unicast\n  circuit-type level-2-only\n  point-to-point\n  hello-password hmac-md5 qwerty12345\n\n \n"
        }
    },
    "msg": "match is exact but all of the following are missing: lines"
}

With match: line (note that the full configuration is not applied under the interfaces)

changed: [51.148.78.121] => {
    "changed": true,
    "commands": [
        "router isis ISIS",
        "interface Loopback0",
        "interface FortyGigE0/0/0/34",
        "circuit-type level-2-only",
        "point-to-point",
        "hello-password hmac-md5 qwerty12345",
        "interface FortyGigE0/0/0/35",
        "circuit-type level-2-only",
        "point-to-point",
        "hello-password hmac-md5 qwerty12345"
    ],
    "diff": {
        "prepared": "Building configuration...\n!! IOS XR Configuration 6.6.3\n   router isis ZEN\n+   interface FortyGigE0/0/0/34\n+    circuit-type level-2-only\n+    point-to-point\n+    hello-password hmac-md5 encrypted 071E36495C1D005445415F59\n    !\n    interface FortyGigE0/0/0/35\n<-   hello-password hmac-md5 encrypted 1406050E1E10337A767B6760\n+>   hello-password hmac-md5 encrypted 00150403164F12575D72181B\n    !\n   !\nend"
    },
    "invocation": {
        "module_args": {
            "admin": false,
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": null,
            "comment": "configured by iosxr_config",
            "config": null,
            "exclusive": false,
            "force": false,
            "host": null,
            "label": null,
            "lines": null,
            "match": "line",
            "parents": null,
            "password": null,
            "port": null,
            "provider": null,
            "replace": "line",
            "src": "router isis ISIS\n is-type level-2-only\n net 49.0001.0000.000.0001.00\n lsp-password keychain ISIS_DOMAIN\n address-family ipv4 unicast\n  metric-style wide\n\n address-family ipv6 unicast\n  metric-style wide\n\n interface Loopback0\n  address-family ipv4 unicast\n  address-family ipv6 unicast\n\n  interface FortyGigE0/0/0/34\n  address-family ipv4 unicast\n  address-family ipv6 unicast\n  circuit-type level-2-only\n  point-to-point\n  hello-password hmac-md5 qwerty12345\n\n  interface FortyGigE0/0/0/35\n  address-family ipv4 unicast\n  address-family ipv6 unicast\n  circuit-type level-2-only\n  point-to-point\n  hello-password hmac-md5 qwerty12345\n\n \n",
            "ssh_keyfile": null,
            "timeout": null,
            "username": null
        }
    }
}
@rohitthakur2590 rohitthakur2590 self-assigned this Apr 22, 2020
@Qalthos Qalthos added this to the February'21 milestone Jan 13, 2021
@Ruchip16 Ruchip16 assigned Ruchip16 and unassigned rohitthakur2590 Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants