Ansible Night in Tokyo 2018.04
https://ansible-users.connpass.com/event/84907/
でのLT資料です。
Ansible 2.5 で、ネットワークモジュール向けに「network_cli」、「netconf」 という2つのコネクションタイプが追加されました。Junos モジュールではどちらも使用できるため、使い分け方をご紹介します。
6. 使い分け方 その2
6
network_cli は奥の手
例えば
• Junosのバージョンにより利用できない構文がある模様
• AWS ami-e8695a8d (15.1X49-D133) の場合:〇 可能
• vagrant の vsrx box (12.1X47-D15.4) の場合:× エラー「Display format ‘set’ is not supported by remote device.」
• 手動での「show configuration | display set」は正常に実行可能
「show configuration | display set」(*1)が
netconf だとエラーになる場合
network_cli で回避
junos_command:
commands:
- show configuration
display: set
junos_command:
commands:
- show configuration | display set
or
*1:Playbook上は以下のような場合
7. (補足)display set は set 形式で出力
7
show configuration
show configuration | display set
set version 12.1X47-D15.4
set system host-name vsrx1
set system root-authentication encrypted-password "$1$(略)"
set system root-authentication ssh-rsa "ssh-rsa (略)"
set system login user vagrant uid 2000
set (略)
version 12.1X47-D15.4;
system {
host-name vsrx1;
root-authentication {
encrypted-password "$1$(略)"; ## SECRET-DATA
ssh-rsa "ssh-rsa (略)"; ## SECRET-DATA
}
login {
user vagrant {
(略)
流し込みしやすい