oliverl_21.ios_config

ansible-role-ios_config

Cisco IOS 設定 Ansible ロール

現在のタスク:

  • RADIUS サーバーの定義
  • ISE/802.1x のグローバル設定
  • デバイスセンサーの設定
  • 802.1x インターフェース設定(部分的、インターフェース選択のロジックが不足)
  • PnP ZTP ワークフロー

機能:

  • インベントリ変数に基づいてバスチオン/ジャンプホスト経由で接続
  • Paramiko から libssh に切り替え

TODO:

要件

RADIUS サーバーの定義:

  • IP アドレス
  • ホスト名
  • RADIUS キー
  • RADIUS ソースインターフェース

インターフェース定義

  • アクセス VLAN
  • フォールバック VLAN(オプション)
  • 音声 VLAN(オプション)
  • 低影響モード(オプション)

LibSSH への切り替え

参考

libssh モジュールの使用(現在は Linux のみ)

pip3 install ansible-pylibssh

このロールのために libssh に切り替え

# roles/ios_config/default.yml
ansible_network_cli_ssh_type: libssh

グローバルに有効にするために ansible.cfg に以下を追加

# ansible.cfg
[persistent_connection]
ssh_type = libssh

バスチオン/ジャンプホスト接続

ネットワークデバイスに接続するためにバスチオン/ジャンプホストを使用するには、以下を作成:

# 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 %}

# すべてのホストのデフォルトバスチオンホスト
bastion_host: ""

ジャンプホストを使用するインベントリホスト/グループ変数に bastion_host: "あなたのホスト" を追加します。ジャンプホストはインベントリに定義する必要があります。

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

[debian:vars]
ansible_user=tux
ansible_become_method=sudo

ロール変数

  • fact_gather_enabled
    • デフォルトは true
  • push_config
    • 設定をデバイスにプッシュするか、設定の差分をローカルに保存するかを定義
  • ios_int_config_enabled
    • インターフェース設定を有効にする
  • ios_sensor_config_enabled
    • IOS デバイスセンサー設定を有効にする
  • ios_1xglobal_config_enabled
    • IOS ISE/802.1x グローバル設定を有効にする
  • int_global_config_enabled
    • 802.1x インターフェース設定を有効にする
  • pnp_config_enabled
    • PnP 設定の生成を有効にする。 fact_gather_enabled: false と一緒に使用する必要があります。

依存関係

ロール:なし

コレクション:

  • cisco.ios
  • ansible.netcommon

例のプレイブック

TODO

- name: example
  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 }

ライセンス

GPL-3.0-or-later

著者情報

oliverl-21

プロジェクトについて

Cisco IOS Configuration role

インストール
ansible-galaxy install oliverl_21.ios_config
ライセンス
Unknown
ダウンロード
103
所有者
nothing to tell