oliverl_21.ios_config

ansible-role-ios_config

Cisco IOS Konfigurations-Ansible-Rolle

Aktuelle Aufgaben:

  • Definition des Radius-Servers
  • Globale Einstellungen für ISE/802.1x
  • Konfiguration des Geräte-Sensors
  • 802.1x Schnittstellenkonfiguration (teilweise, Logik zur Schnittstellenauswahl fehlt)
  • PnP ZTP-Workflow

Merkmale:

  • Verbindung über Bastion/Jumphost basierend auf Inventar-Variablen
  • Umstieg von Paramiko auf libssh

ToDo:

  • DHCP Snooping vertrauenswürdige Schnittstelle
  • Möglicherweise ISE-Konfiguration (ND, NDG)
  • Verfeinerung des PnP ZTP-Workflows
  • und weitere gängige Aufgaben

Anforderungen

Definition des Radius-Servers:

  • IP-Adresse
  • Hostname
  • Radius-Schlüssel
  • Radius-Quellschnittstelle

Definition der Schnittstelle

  • Zugang VLAN
  • Fallback VLAN (optional)
  • Sprach VLAN (optional)
  • Niedriger Einflussmodus (optional)

Umstieg auf LibSSH

Referenz

Verwendung des libssh-Moduls (aktuell nur Linux)

pip3 install ansible-pylibssh

Umstieg auf libssh für diese Rolle

# roles/ios_config/default.yml
ansible_network_cli_ssh_type: libssh

Fügen Sie Folgendes zu ansible.cfg hinzu, um es global zu aktivieren

# ansible.cfg
[persistent_connection]
ssh_type = libssh

Bastion/Jumphost-Verbindung

Um einen Bastion/Jumphost zu verwenden, um mit den Netzwerkgeräten zu verbinden, erstellen Sie:

# inventory/group_vars/all/ansible_ssh.yml
ansible_ssh_proxy_command: >-
  {% if bastion_host is defined and bastion_host != '' %}
  ssh {{ hostvars[bastion_host]['ansible_user'] }}@{{ hostvars[bastion_host]['ansible_host'] }}
  -o Port={{ hostvars[bastion_host]['ansible_ssh_port'] | default(22) }}
  -W %h:%p
  {% endif %}

ansible_ssh_common_args: >-
  {% if bastion_host is defined and bastion_host != '' %}
  -o ProxyCommand="{{ ansible_ssh_proxy_command }}"
  {% endif %}

# Standard-Bastion-Host für alle Hosts
bastion_host: ""

fügen Sie bastion_host: "dein-host" zu Ihren Inventar-Host-/Gruppenvariablen hinzu, wo der Jumphost verwendet werden soll. Der Jumphost muss im Inventar definiert sein.

Beispiel

# inventory/group_vars/ios.yml
---
ansible_user: admin
ansible_network_os: ios
bastion_host: tux01
# inventory/<inventar-file>
[debian]
tux01 ansible_host=tux01.example.org

[debian:vars]
ansible_user=tux
ansible_become_method=sudo

Rollen-Variablen

  • fact_gather_enabled
    • standardmäßig auf true
  • push_config
    • definiert, ob die Konfiguration auf das Gerät übertragen oder die Konfigurationsänderung lokal gespeichert werden soll
  • ios_int_config_enabled
    • aktiviert die Schnittstellenkonfiguration
  • ios_sensor_config_enabled
    • aktiviert die IOS-Geräte-Sensor-Konfiguration
  • ios_1xglobal_config_enabled
    • aktiviert die IOS ISE/802.1x globale Konfiguration
  • int_global_config_enabled
    • aktiviert die 802.1x Schnittstellenkonfiguration
  • pnp_config_enabled
    • aktiviert die Erstellung der PnP-Konfiguration, sollte zusammen mit fact_gather_enabled: false verwendet werden

Abhängigkeiten

Rollen: keine

Sammlung:

  • cisco.ios
  • ansible.netcommon

Beispiel-Playbook

ToDo

- name: beispiel
  hosts: csw02
  gather_facts: false
  connection: network_cli
  roles:
    - { role: ios_config, ios_config_enabled: false, ios_sensor_config_enabled: true, ios_1xglobal_config_enabled: true }

Lizenz

GPL-3.0-or-later

Autoreninformation

oliverl-21

Über das Projekt

Cisco IOS Configuration role

Installieren
ansible-galaxy install oliverl_21.ios_config
GitHub Repository
Lizenz
Unknown
Downloads
103
Besitzer
nothing to tell