Spec-Zone.ru › Ansible 2.11

cisco.nxos.nxos_ospf_interfaces – Модуль ресурсов OSPF интерфейсов.

Примечание

Этот плагин входит в коллекцию cisco.nxos (версия 1.4.0).

Для его установки используйте: ansible-galaxy collection install cisco.nxos.

Для использования в плейбуке укажите: cisco.nxos.nxos_ospf_interfaces.

Добавлен в версии 1.3.0: модуля cisco.nxos

  • Обзор
  • Параметры
  • Примеры
  • Значения возврата

Обзор

  • Этот модуль управляет конфигурацией OSPF(v2/v3) интерфейсов на устройствах, работающих под управлением Cisco NX-OS.

Примечание

Для этого модуля существует соответствующий плагин действий.

Параметры

Параметр Варианты/Значения по умолчанию Комментарии
config
список / элементы=словарь
Список конфигураций OSPF для интерфейсов.
address_family
список / элементы=словарь
Настройки OSPF на интерфейсах в контексте адресной семьи.
afi
строка / обязательно
    Варианты:
  • ipv4
  • ipv6
Идентификатор адресной семьи (AFI) для настроек OSPF на интерфейсах.
authentication
словарь
Настройки аутентификации на интерфейсе.
enable
булево
    Варианты:
  • нет
  • да
Включить/выключить аутентификацию на интерфейсе.
key_chain
строка
Цепочка ключей пароля для аутентификации.
message_digest
булево
    Варианты:
  • нет
  • да
Использовать аутентификацию по хэшу сообщений.
null_auth
булево
    Варианты:
  • нет
  • да
Использовать аутентификацию по умолчанию (отключить).
authentication_key
словарь
Настроить ключ аутентификации для интерфейса.
encryption
целое число
0 Указывает, что последует НЕЗАШИФРОВАННЫЙ ключ аутентификации.
3 Указывает, что последует ключ аутентификации, зашифрованный с помощью 3DES.
7 Указывает, что последует ключ аутентификации, зашифрованный с помощью Cisco type 7.
key
строка / обязательно
Ключ аутентификации.
Допустимые значения — зашифрованный пароль Cisco type 7, зашифрованный пароль 3DES и незашифрованный (в открытом виде) пароль в зависимости от значения ключа шифрования.
cost
целое число
Стоимость, связанная с интерфейсом.
dead_interval
целое число
Значение интервала ожидания (в секундах).
hello_interval
целое число
Значение интервала hello (в секундах).
instance
целое число
Идентификатор экземпляра.
message_digest_key
словарь
Настройки пароля (ключа) аутентификации по хэшу сообщений.
encryption
целое число
0 Указывает, что последует НЕЗАШИФРОВАННЫЙ пароль ospf (ключ).
3 Указывает, что последует ключ ospf, зашифрованный с помощью 3DES.
7 Указывает, что последует ключ ospf, зашифрованный с помощью Cisco type 7.
key
строка / обязательно
Ключ аутентификации.
Допустимые значения — зашифрованный пароль Cisco type 7, зашифрованный пароль 3DES и незашифрованный (в открытом виде) пароль в зависимости от значения ключа шифрования.
key_id
целое число / обязательно
Идентификатор ключа.
mtu_ignore
булево
    Варианты:
  • нет
  • да
Включить/выключить обнаружение несоответствий MTU OSPF.
multi_areas
список / элементы=строка
Многообластные зоны, связанные с интерфейсом (не привязаны к процессу OSPF).
Допустимые значения — идентификаторы зон в виде целых чисел или IP-адресов.
network
строка
    Варианты:
  • вещательная
  • точка-точка
Тип сети.
passive_interface
булево
    Варианты:
  • нет
  • да
Запретить обновления маршрутизации на интерфейсе.
priority
целое число
Приоритет маршрутизатора.
processes
список / элементы=словарь
Настройка интерфейсов для процесса OSPF.
area
словарь
Область, связанная с интерфейсом.
area_id
строка / обязательно
Идентификатор области в формате десятичного числа или IP-адреса.
secondaries
булево
    Варианты:
  • нет
  • да
Исключить вторичные IPv4/IPv6-адреса.
multi_areas
список / элементы=строка
Многообластные зоны, связанные с интерфейсом.
Допустимые значения — идентификаторы зон в виде целых чисел или IP-адресов.
process_id
строка / обязательно
Тег процесса OSPF.
retransmit_interval
целое число
Интервал повторной передачи пакетов.
shutdown
булево
    Варианты:
  • нет
  • да
Отключить OSPF на этом интерфейсе.
transmit_delay
целое число
Задержка передачи пакетов.
name
строка / обязательно
Имя/идентификатор интерфейса.
running_config
строка
Этот параметр используется только в состоянии parsed.
Значение этого параметра должно быть результатом выполнения команды show running-config | section "^interface" на устройстве NX-OS.
Состояние parsed считывает конфигурацию из параметра running_config, преобразует ее в структурированные данные Ansible в соответствии с argspec модуля ресурса, а затем возвращает значение в ключе parsed в результате.
state
строка
    Варианты:
  • слияние ←
  • заменено
  • переопределено
  • удалено
  • собрано
  • обработанно
  • отрендерено
Состояние, в котором должна быть оставлена конфигурация.

Примеры

# Using merged

# Before state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
# interface Ethernet1/2
#   no switchport
# interface Ethernet1/3
#   no switchport

- name: Merge the provided configuration with the exisiting running configuration
  cisco.nxos.nxos_ospf_interfaces:
    config:
      - name: Ethernet1/1
        address_family:
        - afi: ipv4
          processes:
          - process_id: "100"
            area:
              area_id: 1.1.1.1
              secondaries: False
          multi_areas:
          - 11.11.11.11
        - afi: ipv6
          processes:
          - process_id: "200"
            area:
              area_id: 2.2.2.2
            multi_areas:
            - 21.0.0.0
          - process_id: "300"
            multi_areas:
            - 50.50.50.50
          multi_areas:
          - 16.10.10.10
      - name: Ethernet1/2
        address_family:
        - afi: ipv4
          authentication:
            enable: True
            key_chain: test-1
          message_digest_key:
            key_id: 10
            encryption: 3
            key: abc01d272be25d29
          cost: 100
        - afi: ipv6
          network: broadcast
          shutdown: True
      - name: Ethernet1/3
        address_family:
        - afi: ipv4
          authentication_key:
            encryption: 7
            key: 12090404011C03162E
    state: merged

# Task output
# -------------
# "before": [
#        {
#            "name": "Ethernet1/1"
#        },
#        {
#            "name": "Ethernet1/2"
#        },
#        {
#            "name": "Ethernet1/3"
#        },
# ]
#
# "commands": [
#        "interface Ethernet1/1",
#        "ip router ospf multi-area 11.11.11.11",
#        "ip router ospf 100 area 1.1.1.1 secondaries none",
#        "ipv6 router ospfv3 multi-area 16.10.10.10",
#        "ipv6 router ospfv3 200 area 2.2.2.2",
#        "ipv6 router ospfv3 200 multi-area 21.0.0.0",
#        "ipv6 router ospfv3 300 multi-area 50.50.50.50",
#        "interface Ethernet1/2",
#        "ip ospf authentication key-chain test-1",
#        "ip ospf authentication",
#        "ip ospf message-digest-key 10 md5 3 abc01d272be25d29",
#        "ip ospf cost 100",
#        "ospfv3 network broadcast",
#        "ospfv3 shutdown",
#        "interface Ethernet1/3",
#        "ip ospf authentication-key 7 12090404011C03162E"
# ]
#
# "after": [
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "multi_areas": [
#                        "11.11.11.11"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "1.1.1.1",
#                                "secondaries": false
#                            },
#                            "process_id": "100"
#                        }
#                    ]
#                },
#                {
#                    "afi": "ipv6",
#                    "multi_areas": [
#                        "16.10.10.10"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "2.2.2.2"
#                            },
#                            "multi_areas": [
#                                "21.0.0.0"
#                            ],
#                            "process_id": "200"
#                        },
#                        {
#                            "multi_areas": [
#                                "50.50.50.50"
#                            ],
#                            "process_id": "300"
#                        }
#                    ]
#                }
#            ],
#            "name": "Ethernet1/1"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication": {
#                       "enable": true,
#                       "key_chain": "test-1"
#                    },
#                    "cost": 100,
#                    "message_digest_key": {
#                        "encryption": 3,
#                        "key": "abc01d272be25d29",
#                        "key_id": 10
#                    }
#                },
#                {
#                    "afi": "ipv6",
#                    "network": "broadcast",
#                    "shutdown": true
#                }
#            ],
#            "name": "Ethernet1/2"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication_key": {
#                        "encryption": 7,
#                        "key": "12090404011C03162E"
#                    }
#                }
#            ],
#            "name": "Ethernet1/3"
#        },
# ]

# After state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E


# Using replaced

# Before state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

- name: Replace OSPF configurations of listed interfaces with provided configurations
  cisco.nxos.nxos_ospf_interfaces:
    config:
    - name: Ethernet1/1
      address_family:
      - afi: ipv4
        processes:
        - process_id: "100"
          area:
            area_id: 1.1.1.1
            secondaries: False
        multi_areas:
        - 11.11.11.12
    - name: Ethernet1/3
    state: replaced

# Task output
# -------------
# "before": [
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "multi_areas": [
#                        "11.11.11.11"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "1.1.1.1",
#                                "secondaries": false
#                            },
#                            "process_id": "100"
#                        }
#                    ]
#                },
#                {
#                    "afi": "ipv6",
#                    "multi_areas": [
#                        "16.10.10.10"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "2.2.2.2"
#                            },
#                            "multi_areas": [
#                                "21.0.0.0"
#                            ],
#                            "process_id": "200"
#                        },
#                        {
#                            "multi_areas": [
#                                "50.50.50.50"
#                            ],
#                            "process_id": "300"
#                        }
#                    ]
#                }
#            ],
#            "name": "Ethernet1/1"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication": {
#                       "enable": true,
#                       "key_chain": "test-1"
#                    },
#                    "cost": 100,
#                    "message_digest_key": {
#                        "encryption": 3,
#                        "key": "abc01d272be25d29",
#                        "key_id": 10
#                    }
#                },
#                {
#                    "afi": "ipv6",
#                    "network": "broadcast",
#                    "shutdown": true
#                }
#            ],
#            "name": "Ethernet1/2"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication_key": {
#                        "encryption": 7,
#                        "key": "12090404011C03162E"
#                    }
#                }
#            ],
#            "name": "Ethernet1/3"
#        },
# ]
#
# "commands": [
#        "interface Ethernet1/1",
#        "ip router ospf multi-area 11.11.11.12",
#        "no ip router ospf multi-area 11.11.11.11",
#        "no ipv6 router ospfv3 multi-area 16.10.10.10",
#        "no ipv6 router ospfv3 200 area 2.2.2.2",
#        "no ipv6 router ospfv3 200 multi-area 21.0.0.0",
#        "no ipv6 router ospfv3 300 multi-area 50.50.50.50",
#        "interface Ethernet1/3",
#        "no ip ospf authentication-key 7 12090404011C03162E"
# ]
#
# "after": [
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "multi_areas": [
#                        "11.11.11.12"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "1.1.1.1",
#                                "secondaries": false
#                            },
#                            "process_id": "100"
#                        }
#                    ]
#                }
#            ],
#            "name": "Ethernet1/1"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication": {
#                        "enable": true,
#                        "key_chain": "test-1"
#                    },
#                    "cost": 100,
#                    "message_digest_key": {
#                        "encryption": 3,
#                        "key": "abc01d272be25d29",
#                        "key_id": 10
#                    }
#                },
#                {
#                    "afi": "ipv6",
#                    "network": "broadcast",
#                    "shutdown": true
#                }
#            ],
#            "name": "Ethernet1/2"
#        },
#        {
#            "name": "Ethernet1/3"
#        },
#
# After state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.12
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport


# Using overridden

# Before state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

- name: Overridde all OSPF interfaces configuration with provided configuration
  cisco.nxos.nxos_ospf_interfaces:
    config:
    - name: Ethernet1/1
      address_family:
      - afi: ipv4
        processes:
        - process_id: "100"
          area:
            area_id: 1.1.1.1
            secondaries: False
        multi_areas:
        - 11.11.11.12
    state: overridden

# Task output
# -------------
# "before": [
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "multi_areas": [
#                        "11.11.11.11"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "1.1.1.1",
#                                "secondaries": false
#                            },
#                            "process_id": "100"
#                        }
#                    ]
#                },
#                {
#                    "afi": "ipv6",
#                    "multi_areas": [
#                        "16.10.10.10"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "2.2.2.2"
#                            },
#                            "multi_areas": [
#                                "21.0.0.0"
#                            ],
#                            "process_id": "200"
#                        },
#                        {
#                            "multi_areas": [
#                                "50.50.50.50"
#                            ],
#                            "process_id": "300"
#                        }
#                    ]
#                }
#            ],
#            "name": "Ethernet1/1"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication": {
#                       "enable": true,
#                       "key_chain": "test-1"
#                    },
#                    "cost": 100,
#                    "message_digest_key": {
#                        "encryption": 3,
#                        "key": "abc01d272be25d29",
#                        "key_id": 10
#                    }
#                },
#                {
#                    "afi": "ipv6",
#                    "network": "broadcast",
#                    "shutdown": true
#                }
#            ],
#            "name": "Ethernet1/2"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication_key": {
#                        "encryption": 7,
#                        "key": "12090404011C03162E"
#                    }
#                }
#            ],
#            "name": "Ethernet1/3"
#        },
# ]
#
# "commands": [
#        "interface Ethernet1/2",
#        "no ip ospf authentication key-chain test-1",
#        "no ip ospf authentication",
#        "no ip ospf message-digest-key 10 md5 3 abc01d272be25d29",
#        "no ip ospf cost 100",
#        "no ospfv3 network broadcast",
#        "no ospfv3 shutdown",
#        "interface Ethernet1/3",
#        "no ip ospf authentication-key 7 12090404011C03162E",
#        "interface Ethernet1/1",
#        "ip router ospf multi-area 11.11.11.12",
#        "no ip router ospf multi-area 11.11.11.11",
#        "no ipv6 router ospfv3 multi-area 16.10.10.10",
#        "no ipv6 router ospfv3 200 area 2.2.2.2",
#        "no ipv6 router ospfv3 200 multi-area 21.0.0.0",
#        "no ipv6 router ospfv3 300 multi-area 50.50.50.50"
# ]
#
# "after": [
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "multi_areas": [
#                        "11.11.11.12"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "1.1.1.1",
#                                "secondaries": false
#                            },
#                            "process_id": "100"
#                        }
#                    ]
#                }
#            ],
#            "name": "Ethernet1/1"
#        },
#        {
#            "name": "Ethernet1/2"
#        },
#        {
#            "name": "Ethernet1/3"
#        },
# ]

# After state:
# -------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.12
# interface Ethernet1/2
#   no switchport
# interface Ethernet1/3
#   no switchport

# Using deleted to delete OSPF config of a single interface

# Before state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

- name: Delete OSPF config from a single interface
  cisco.nxos.nxos_ospf_interfaces:
    config:
      - name: Ethernet1/1
    state: deleted

# Task output
# -------------
# "before": [
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "multi_areas": [
#                        "11.11.11.11"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "1.1.1.1",
#                                "secondaries": false
#                            },
#                            "process_id": "100"
#                        }
#                    ]
#                },
#                {
#                    "afi": "ipv6",
#                    "multi_areas": [
#                        "16.10.10.10"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "2.2.2.2"
#                            },
#                            "multi_areas": [
#                                "21.0.0.0"
#                            ],
#                            "process_id": "200"
#                        },
#                        {
#                            "multi_areas": [
#                                "50.50.50.50"
#                            ],
#                            "process_id": "300"
#                        }
#                    ]
#                }
#            ],
#            "name": "Ethernet1/1"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication": {
#                       "enable": true,
#                       "key_chain": "test-1"
#                    },
#                    "cost": 100,
#                    "message_digest_key": {
#                        "encryption": 3,
#                        "key": "abc01d272be25d29",
#                        "key_id": 10
#                    }
#                },
#                {
#                    "afi": "ipv6",
#                    "network": "broadcast",
#                    "shutdown": true
#                }
#            ],
#            "name": "Ethernet1/2"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication_key": {
#                        "encryption": 7,
#                        "key": "12090404011C03162E"
#                    }
#                }
#            ],
#            "name": "Ethernet1/3"
#        },
# ]
#
# "commands": [
#        "interface Ethernet1/1",
#        "no ip router ospf multi-area 11.11.11.11",
#        "no ip router ospf 100 area 1.1.1.1 secondaries none",
#        "no ipv6 router ospfv3 multi-area 16.10.10.10",
#        "no ipv6 router ospfv3 200 area 2.2.2.2",
#        "no ipv6 router ospfv3 200 multi-area 21.0.0.0",
#        "no ipv6 router ospfv3 300 multi-area 50.50.50.50"
# ]
#
# "before": [
#        {
#            "name": "Ethernet1/1"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication": {
#                       "enable": true,
#                       "key_chain": "test-1"
#                    },
#                    "cost": 100,
#                    "message_digest_key": {
#                        "encryption": 3,
#                        "key": "abc01d272be25d29",
#                        "key_id": 10
#                    }
#                },
#                {
#                    "afi": "ipv6",
#                    "network": "broadcast",
#                    "shutdown": true
#                }
#            ],
#            "name": "Ethernet1/2"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication_key": {
#                        "encryption": 7,
#                        "key": "12090404011C03162E"
#                    }
#                }
#            ],
#            "name": "Ethernet1/3"
#        },
# ]

# After state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

# Using deleted to delete OSPF config from all interfaces

# Before state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 multi-area 16.10.10.10
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport
#   ip ospf authentication-key 7 12090404011C03162E

- name: Delete OSPF config from all interfaces
  cisco.nxos.nxos_ospf_interfaces:
    state: deleted

# Task output
# -------------
# "before": [
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "multi_areas": [
#                        "11.11.11.11"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "1.1.1.1",
#                                "secondaries": false
#                            },
#                            "process_id": "100"
#                        }
#                    ]
#                },
#                {
#                    "afi": "ipv6",
#                    "multi_areas": [
#                        "16.10.10.10"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "2.2.2.2"
#                            },
#                            "multi_areas": [
#                                "21.0.0.0"
#                            ],
#                            "process_id": "200"
#                        },
#                        {
#                            "multi_areas": [
#                                "50.50.50.50"
#                            ],
#                            "process_id": "300"
#                        }
#                    ]
#                }
#            ],
#            "name": "Ethernet1/1"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication": {
#                       "enable": true,
#                       "key_chain": "test-1"
#                    },
#                    "cost": 100,
#                    "message_digest_key": {
#                        "encryption": 3,
#                        "key": "abc01d272be25d29",
#                        "key_id": 10
#                    }
#                },
#                {
#                    "afi": "ipv6",
#                    "network": "broadcast",
#                    "shutdown": true
#                }
#            ],
#            "name": "Ethernet1/2"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication_key": {
#                        "encryption": 7,
#                        "key": "12090404011C03162E"
#                    }
#                }
#            ],
#            "name": "Ethernet1/3"
#        },
# ]
#
# "commands": [
#        "interface Ethernet1/1",
#        "no ip router ospf multi-area 11.11.11.11",
#        "no ip router ospf 100 area 1.1.1.1 secondaries none",
#        "no ipv6 router ospfv3 multi-area 16.10.10.10",
#        "no ipv6 router ospfv3 200 area 2.2.2.2",
#        "no ipv6 router ospfv3 200 multi-area 21.0.0.0",
#        "no ipv6 router ospfv3 300 multi-area 50.50.50.50",
#        "interface Ethernet1/2",
#        "no ip ospf authentication key-chain test-1",
#        "no ip ospf authentication",
#        "no ip ospf message-digest-key 10 md5 3 abc01d272be25d29",
#        "no ip ospf cost 100",
#        "no ospfv3 network broadcast",
#        "no ospfv3 shutdown",
#        "interface Ethernet1/3",
#        "no ip ospf authentication-key 7 12090404011C03162E"
# ]
#
# "after": [
#        {
#            "name": "Ethernet1/1"
#        },
#        {
#            "name": "Ethernet1/2"
#        },
#        {
#            "name": "Ethernet1/3"
#        },
# ]

# After state:
# ------------
# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
# interface Ethernet1/2
#   no switchport
# interface Ethernet1/3
#   no switchport

# Using rendered

- name: Render platform specific configuration lines with state rendered (without connecting to the device)
  cisco.nxos.nxos_ospf_interfaces:
    config:
      - name: Ethernet1/1
        address_family:
        - afi: ipv4
          processes:
          - process_id: "100"
            area:
              area_id: 1.1.1.1
              secondaries: False
          multi_areas:
          - 11.11.11.11
        - afi: ipv6
          processes:
          - process_id: "200"
            area:
              area_id: 2.2.2.2
            multi_areas:
            - 21.0.0.0
          - process_id: "300"
            multi_areas:
            - 50.50.50.50
          multi_areas:
          - 16.10.10.10
      - name: Ethernet1/2
        address_family:
        - afi: ipv4
          authentication:
            enable: True
            key_chain: test-1
          message_digest_key:
            key_id: 10
            encryption: 3
            key: abc01d272be25d29
          cost: 100
        - afi: ipv6
          network: broadcast
          shutdown: True
      - name: Ethernet1/3
        address_family:
        - afi: ipv4
          authentication_key:
            encryption: 7
            key: 12090404011C03162E
    state: rendered

# Task Output (redacted)
# -----------------------
# "rendered": [
#        "interface Ethernet1/1",
#        "ip router ospf multi-area 11.11.11.11",
#        "ip router ospf 100 area 1.1.1.1 secondaries none",
#        "ipv6 router ospfv3 multi-area 16.10.10.10",
#        "ipv6 router ospfv3 200 area 2.2.2.2",
#        "ipv6 router ospfv3 200 multi-area 21.0.0.0",
#        "ipv6 router ospfv3 300 multi-area 50.50.50.50",
#        "interface Ethernet1/2",
#        "ip ospf authentication key-chain test-1",
#        "ip ospf authentication",
#        "ip ospf message-digest-key 10 md5 3 abc01d272be25d29",
#        "ip ospf cost 100",
#        "ospfv3 network broadcast",
#        "ospfv3 shutdown",
#        "interface Ethernet1/3",
#        "ip ospf authentication-key 7 12090404011C03162E"
# ]

# Using parsed

# parsed.cfg
# ------------
# interface Ethernet1/1
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.11
#   ipv6 router ospfv3 200 area 2.2.2.2
#   ipv6 router ospfv3 200 multi-area 21.0.0.0
#   ipv6 router ospfv3 300 multi-area 50.50.50.50
#   ipv6 router ospfv3 multi-area 16.10.10.10
# interface Ethernet1/2
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   ip ospf authentication-key 7 12090404011C03162E

- name: arse externally provided OSPF interfaces config
  cisco.nxos.nxos_ospf_interfaces:
    running_config: "{{ lookup('file', 'ospf_interfaces.cfg') }}"
    state: parsed

# Task output (redacted)
# -----------------------
# "parsed": [
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "multi_areas": [
#                        "11.11.11.11"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "1.1.1.1",
#                                "secondaries": false
#                            },
#                            "process_id": "100"
#                        }
#                    ]
#                },
#                {
#                    "afi": "ipv6",
#                    "multi_areas": [
#                        "16.10.10.10"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "2.2.2.2"
#                            },
#                            "multi_areas": [
#                                "21.0.0.0"
#                            ],
#                            "process_id": "200"
#                        },
#                        {
#                            "multi_areas": [
#                                "50.50.50.50"
#                            ],
#                            "process_id": "300"
#                        }
#                    ]
#                }
#            ],
#            "name": "Ethernet1/1"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication": {
#                       "enable": true,
#                       "key_chain": "test-1"
#                    },
#                    "cost": 100,
#                    "message_digest_key": {
#                        "encryption": 3,
#                        "key": "abc01d272be25d29",
#                        "key_id": 10
#                    }
#                },
#                {
#                    "afi": "ipv6",
#                    "network": "broadcast",
#                    "shutdown": true
#                }
#            ],
#            "name": "Ethernet1/2"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication_key": {
#                        "encryption": 7,
#                        "key": "12090404011C03162E"
#                    }
#                }
#            ],
#            "name": "Ethernet1/3"
#        },
# ]

# Using gathered

# On-box config

# NXOS# show running-config | section ^interface
# interface Ethernet1/1
#   no switchport
#   ip router ospf 100 area 1.1.1.1 secondaries none
#   ip router ospf multi-area 11.11.11.12
# interface Ethernet1/2
#   no switchport
#   ip ospf authentication
#   ip ospf authentication key-chain test-1
#   ip ospf message-digest-key 10 md5 3 abc01d272be25d29
#   ip ospf cost 100
#   ospfv3 network broadcast
#   ospfv3 shutdown
# interface Ethernet1/3
#   no switchport

# Task output (redacted)
# -----------------------
# "gathered": [
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "multi_areas": [
#                        "11.11.11.12"
#                    ],
#                    "processes": [
#                        {
#                            "area": {
#                                "area_id": "1.1.1.1",
#                                "secondaries": false
#                            },
#                            "process_id": "100"
#                        }
#                    ]
#                }
#            ],
#            "name": "Ethernet1/1"
#        },
#        {
#            "address_family": [
#                {
#                    "afi": "ipv4",
#                    "authentication": {
#                        "enable": true,
#                        "key_chain": "test-1"
#                    },
#                    "cost": 100,
#                    "message_digest_key": {
#                        "encryption": 3,
#                        "key": "abc01d272be25d29",
#                        "key_id": 10
#                    }
#                },
#                {
#                    "afi": "ipv6",
#                    "network": "broadcast",
#                    "shutdown": true
#                }
#            ],
#            "name": "Ethernet1/2"
#        },
#        {
#            "name": "Ethernet1/3"
#        },

Значения возврата

Общие значения возврата описаны здесь, следующие поля уникальны для данного модуля:

Ключ Возвращаемое значение Описание
after
list / elements=string
при изменении
Вызов возвращаемой модели конфигурации.

Пример:
Возвращаемая конфигурация всегда будет в том же формате, что и параметры выше.
before
list / elements=string
всегда
Конфигурация до вызова модели.

Пример:
Возвращаемая конфигурация всегда будет в том же формате, что и параметры выше.
commands
list / elements=string
всегда
Набор команд, отправленных на удаленное устройство.

Пример:
['interface Ethernet1/1', 'ip router ospf multi-area 11.11.11.11', 'ip router ospf 100 area 1.1.1.1 secondaries none', 'no ipv6 router ospfv3 multi-area 16.10.10.10', 'ipv6 router ospfv3 200 area 2.2.2.2', 'ipv6 router ospfv3 200 multi-area 21.0.0.0', 'ipv6 router ospfv3 300 multi-area 50.50.50.50', 'interface Ethernet1/2', 'no ip ospf authentication key-chain test-1', 'ip ospf authentication']


Авторы

  • Nilashish Chakraborty (@NilashishC)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/cisco/nxos/nxos_ospf_interfaces_module.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API