Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Red Hat Tech Night 2018: Ansible x Network Ansibleで実践するネットワーク自動化

hiyokotaisa
November 08, 2018

Red Hat Tech Night 2018: Ansible x Network Ansibleで実践するネットワーク自動化

2018/11/8(木)に開催されたRed Hat Tech Night 2018のLT資料です。

hiyokotaisa

November 08, 2018
Tweet

More Decks by hiyokotaisa

Other Decks in Technology

Transcript

  1. Red Hat Who is Talking? 2 八木澤 健人 Technical Support

    Engineer - Ansible Ansible Engine / Ansible Tower を 快適に使うお手伝いをしています @hiyoko_taisa
  2. Red Hat おしながき ✓ ごあいさつ ▪ Ansibleでネットワークモジュールを使う ◦ Ansibleの動作 ◦

    Ansibleの設定 ▪ 実行する ◦ Factsで情報を取得 ◦ Interfaceを設定する 3
  3. Red Hat Ansibleの設定 6 • ansible_connection を指定 network_cli: SSHプロトコルによる接続 netconf:

    netconfプロトコルによる接続 (Juniper Junos等) httpapi: Cisco NX-OSやArista EOS向けのAPI経由での接続 • ansible_network_os を指定(Cisco IOS なら ios など)
  4. Red Hat factsで情報を取得 8 --- - hosts: all gather_facts: no

    tasks: - name: gather vyos config vyos_facts: gather_subset: all - name: print vyos config debug: msg: "{{ ansible_facts }}" test.yml
  5. Red Hat 実行結果 9 TASK [print vyos config] ******************************************************* ok:

    [192.168.100.254] => { "msg": { "net_commits": [ ~~~ "net_config": [ "set interfaces ethernet eth0 address 'dhcp' set interfaces ethernet eth0 duplex 'auto' set interfaces ethernet eth0 hw-id '08:00:27:0f:ec:bf' set interfaces ethernet eth0 smp_affinity 'auto' set interfaces ethernet eth0 speed 'auto' set interfaces ethernet eth1 hw-id '08:00:27:61:f5:c9' set interfaces ethernet eth2 hw-id '08:00:27:5b:4a:45' set interfaces ethernet eth3 hw-id '08:00:27:05:3d:f2'
  6. Red Hat Interfaceを設定 10 - name: Set eth1 IPv4 address

    vyos_l3_interface: name: eth1 ipv4: 192.168.101.254/24 test.yml
  7. Red Hat 実行結果 11 set interfaces ethernet eth0 address 'dhcp'

    set interfaces ethernet eth0 duplex 'auto' set interfaces ethernet eth0 hw-id '08:00:27:0f:ec:bf' set interfaces ethernet eth0 smp_affinity 'auto' set interfaces ethernet eth0 speed 'auto' set interfaces ethernet eth1 address '192.168.101.254/24' set interfaces ethernet eth1 hw-id '08:00:27:61:f5:c9'