Skip to content

Instantly share code, notes, and snippets.

@ganeshrn
Last active March 7, 2018 19:36
Show Gist options
  • Save ganeshrn/2c71ecd8f65592265c27bae586bd5962 to your computer and use it in GitHub Desktop.
Save ganeshrn/2c71ecd8f65592265c27bae586bd5962 to your computer and use it in GitHub Desktop.
interfaces task
---
- debug:
msg: "{{ config }}"
- name: validate the variant variable
fail:
msg: "missing required fact: variant"
when: variant is undefined
- name: Validate interfaces config in openconfig format
openconfig_interfaces:
interfaces:
- interface:
config:
description: "{{ item.0.1.config.description }}"
enabled: "{{ item.0.1.config.enabled }}"
loopback_mode: "{{ item.0.1.config.loopback_mode }}"
mtu: "{{ item.0.1.config.mtu }}"
name: "{{ item.0.1.config.name }}"
type: "{{ item.0.1.config.type }}"
hold_time:
config:
up: "{{ item.0.1.hold_time.up }}"
down: "{{ item.0.1.hold_time.down }}"
subinterfaces:
subinterface:
config:
description: "{{ item.0.1.subinterfaces.subinterface.description }}"
enabled: "{{ item.0.1.subinterfaces.subinterface.enabled }}"
index: "{{ item.0.1.subinterfaces.subinterface.index }}"
with_subelements:
- "{{ config }}"
- interface
register: oc_interfaces
when: variant == "openconfig"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment