Automation Cumulus with Playbook-Ansible

Preparation

Memberikan akses “root/sudo” pada user user tanpa password pada semua perangkat, baik di dalam server maupun switch yang terhubung dalam ansible. Dalam kasus ini menggunakan user ubuntu dan dapat diubah sesuai kebutuhan.

sudo usermod -aG sudo ubuntu
echo "ubuntu ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/ubuntu

update dan upgrade system

sudo apt-get update && sudo apt-get upgrade -y

install python3-dev dan virtual environment

sudo apt-get install python3-dev python3-venv -y

install git dan copy repository file git ‘nvue’ yang dibutuhkan dari gitlab cumulus

sudo apt-get install git -y && git clone --branch cumulus-linux-automation-workshop https://gitlab.com/nvidia-networking/systems-engineering/nvue.git

jika sudah maka akan tercopy file-file berikut:

ubuntu@ubuntu2:~$ ls nvue/ -l
total 80
-rw-rw-r-- 1 ubuntu ubuntu   478 Sep 19 05:14 Dockerfile
-rw-rw-r-- 1 ubuntu ubuntu   557 Sep 19 05:14 LICENSE
-rw-rw-r-- 1 ubuntu ubuntu 50628 Sep 19 05:14 Playbooks-demo.md
-rw-rw-r-- 1 ubuntu ubuntu  3140 Sep 19 05:14 README.md
-rw-rw-r-- 1 ubuntu ubuntu   649 Sep 19 05:14 ansible.cfg
drwxrwxr-x 2 ubuntu ubuntu  4096 Sep 19 05:14 host_vars
-rw-rw-r-- 1 ubuntu ubuntu   265 Sep 19 05:14 hosts
drwxrwxr-x 4 ubuntu ubuntu  4096 Sep 19 05:14 playbooks

Create virtual environment dan masuk ke dalamnya.

python3 -m venv nvue/venv1
source nvue/venv1/bin/activate

Install ansible dan module paramiko di dalam virtual environment

pip install ansible paramiko

Installation

Install NVIDIA NVUE collection dengan Ansible Galaxy CLI

ansible-galaxy collection install nvidia.nvue

Verifikasi nvidia.nvue telah berhasil di-install:

(venv1) ubuntu@ubuntu2:~$ ansible-galaxy collection list | grep nvidia.nvue
nvidia.nvue                   1.0.1

Tambahkan IP host dan hostname yang akan di-deploy di dalam file /etc/hosts, karena dalam kasus ini terdapat 3 device yang terdiri dari 2 leaf dan 1 spine

127.0.0.1 localhost
127.0.1.1 ubuntu

10.6.10.20 spine01
10.6.10.21 leaf01
10.6.10.22 leaf02

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Dan ubah file hosts yang ada di dalam file nvue sesuai kebutuhan,

(venv1) ubuntu@ubuntu2:~/nvue$ cat hosts
[leaf-1]
leaf01

[leaf-2]
leaf02 

[spine-1]
spine01 

[leafs:children]
leaf-1
leaf-2

[spines:children]
spine-1

[switches:children]
leafs
spines

[switches:vars]
ansible_user=cumulus
ansible_password=cumulus1

Verifikasi konektivitas ke beberapa switch dengan module ping

(venv1) ubuntu@ubuntu2:~/nvue$ ansible switches -m ping -i hosts
[WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details
spine01 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.7"
    },
    "changed": false,
    "ping": "pong"
}
leaf02 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.7"
    },
    "changed": false,
    "ping": "pong"
}
leaf01 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.7"
    },
    "changed": false,
    "ping": "pong"
}

SETTING UP NVUE API ACCESS

secara default NVUE REST API dalam keadaan ter-disabled. jika ingin menggunakan beberapa module objek tertentu atau api module, kita perlu meng-enable NVUE REST API pada switch yang ada dengan command berikut:

cumulus@switch:~$ sudo ln -s /etc/nginx/sites-{available,enabled}/nvue.conf 
cumulus@switch:~$ sudo sed -i 's/listen localhost:8765 ssl;/listen \[::\]:8765 ipv6only=off ssl;/g' /etc/nginx/sites-available/nvue.conf 
cumulus@switch:~$ sudo systemctl restart nginx

Tetapi bisa juga menggunakan ansible-playbook untuk meng-enable NVUE REST API melintasi switch yang ada di dalam playbook. Sebelumnya perlu mengubah bagian TEST API Connectivity pada file enable-nvue-api.yml yang ada di dalam folder playbook

    - name: Test API Connectivity
      register: apioutput
      uri:
        url: "https://127.0.0.1:8765/nvue_v1/revision"
        validate_certs: false
        user: "{{ansible_user}}" 
        password: "{{ansible_password}}"
        method: "GET"
        status_code: 
          - 200
(venv1) ubuntu@ubuntu2:~/nvue$ ansible-playbook playbooks/enable-nvue-api.yml -i hosts
[WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details

PLAY [Enable REST API on all the switches] *************************************

TASK [Gathering Facts] *********************************************************
ok: [spine01]
ok: [leaf01]
ok: [leaf02]

TASK [Create a link to the NVUE Config file] ***********************************
ok: [leaf02]
ok: [spine01]
ok: [leaf01]

TASK [Add the listening port] **************************************************
ok: [spine01]
ok: [leaf02]
ok: [leaf01]

TASK [Flush handlers] **********************************************************

TASK [Flush handlers] **********************************************************

TASK [Flush handlers] **********************************************************

TASK [Test API Connectivity] ***************************************************
ok: [leaf02]
ok: [leaf01]
ok: [spine01]

PLAY RECAP *********************************************************************
leaf01                     : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
leaf02                     : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
spine01                    : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Sample playbooks

File gather-config.yml menggunakan api high-level untuk mengambil konfigurasi root dan object-level interface module untuk mengambil konfigurasi interface yang ada.

(venv1) ubuntu@ubuntu2:~/nvue$ ansible-playbook playbooks/gather-config.yml -i hosts
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

PLAY [NVUE API] ***********************************************************************************

TASK [Get the current config] *********************************************************************
ok: [leaf01]

TASK [Print current config] ***********************************************************************
ok: [leaf01] =>
  msg:
    changed: false
    failed: false
    message:
      acl: {}
      bridge:
        domain:
          br_default:
            ageing: 1800
            encap: 802.1Q
            mac-address: auto
            multicast:
              snooping:
                enable: 'on'
                querier:
                  enable: 'off'
            stp:
              priority: 32768
              state:
                up: {}
            type: vlan-aware
            untagged: 1
            vlan:
              '1':
                multicast:
                  snooping:
                    querier:
                      source-ip: 0.0.0.0
                ptp:
                  enable: 'off'
                vni: {}
            vlan-vni-offset: 0
      evpn:
        enable: 'off'
      header:
        model: VX
        nvue-api-version: nvue_v1
        rev-id: 1.0
        version: Cumulus Linux 5.5.1
      interface:
        eth0:
          acl: {}
          ip:
            address:
              10.6.10.21/24: {}
            gateway:
              10.6.10.1: {}
            ipv4:
              forward: 'off'
            ipv6:
              enable: 'on'
              forward: 'off'
            vrf: mgmt
          link:
            auto-negotiate: 'on'
            duplex: full
            fec: auto
            mtu: 9216
            speed: auto
            state:
              up: {}
          type: eth
        lo:
          ip:
            address: {}
            igmp:
              enable: 'off'
            ipv4:
              forward: 'on'
            ipv6:
              enable: 'on'
              forward: 'on'
            vrf: default
          router:
            adaptive-routing:
              enable: 'off'
            ospf:
              enable: 'off'
            ospf6:
              enable: 'off'
            pim:
              enable: 'off'
          type: loopback
      mlag:
        enable: 'off'
      nve:
        vxlan:
          enable: 'off'
      qos:
        advance-buffer-config:
          default-global:
            egress-lossy-buffer:
              multicast-switch-priority:
                '0':
                  service-pool: '0'
                '1':
                  service-pool: '0'
                '2':
                  service-pool: '0'
                '3':
                  service-pool: '0'
                '4':
                  service-pool: '0'
                '5':
                  service-pool: '0'
                '6':
                  service-pool: '0'
                '7':
                  service-pool: '0'
              traffic-class:
                '0':
                  service-pool: '0'
                '1':
                  service-pool: '0'
                '2':
                  service-pool: '0'
                '3':
                  service-pool: '0'
                '4':
                  service-pool: '0'
                '5':
                  service-pool: '0'
                '6':
                  service-pool: '0'
                '7':
                  service-pool: '0'
            egress-pool:
              '0':
                memory-percent: 100
                mode: dynamic
            ingress-lossy-buffer:
              priority-group:
                bulk:
                  service-pool: '0'
                  switch-priority:
                    '0': {}
                    '1': {}
                    '2': {}
                    '3': {}
                    '4': {}
                    '5': {}
                    '6': {}
                    '7': {}
            ingress-pool:
              '0':
                memory-percent: 100
                mode: dynamic
        congestion-control:
          default-global:
            traffic-class:
              '0':
                ecn: enable
                max-threshold: 1500000
                min-threshold: 150000
                probability: 100
                red: disable
        egress-queue-mapping:
          default-global:
            switch-priority:
              '0':
                traffic-class: 0
              '1':
                traffic-class: 1
              '2':
                traffic-class: 2
              '3':
                traffic-class: 3
              '4':
                traffic-class: 4
              '5':
                traffic-class: 5
              '6':
                traffic-class: 6
              '7':
                traffic-class: 7
        egress-scheduler:
          default-global:
            traffic-class:
              '0':
                bw-percent: 12
                mode: dwrr
              '1':
                bw-percent: 13
                mode: dwrr
              '2':
                bw-percent: 12
                mode: dwrr
              '3':
                bw-percent: 13
                mode: dwrr
              '4':
                bw-percent: 12
                mode: dwrr
              '5':
                bw-percent: 13
                mode: dwrr
              '6':
                bw-percent: 12
                mode: dwrr
              '7':
                bw-percent: 13
                mode: dwrr
        egress-shaper: {}
        link-pause: {}
        mapping:
          default-global:
            pcp:
              '0':
                switch-priority: 0
              '1':
                switch-priority: 1
              '2':
                switch-priority: 2
              '3':
                switch-priority: 3
              '4':
                switch-priority: 4
              '5':
                switch-priority: 5
              '6':
                switch-priority: 6
              '7':
                switch-priority: 7
            port-default-sp: 0
            trust: l2
        pfc: {}
        remark:
          default-global: {}
        roce:
          enable: 'off'
        traffic-pool:
          default-lossy:
            memory-percent: 100
            switch-priority:
              '0': {}
              '1': {}
              '2': {}
              '3': {}
              '4': {}
              '5': {}
              '6': {}
              '7': {}
      router:
        adaptive-routing:
          enable: 'off'
        bgp:
          enable: 'off'
        igmp:
          enable: 'off'
        nexthop:
          group: {}
        ospf:
          enable: 'off'
        ospf6:
          enable: 'off'
        pbr:
          enable: 'off'
        pim:
          enable: 'off'
        policy:
          as-path-list: {}
          community-list: {}
          ext-community-list: {}
          large-community-list: {}
          prefix-list: {}
          route-map: {}
        ptm:
          enable: 'off'
        vrr:
          enable: 'off'
        vrrp:
          enable: 'off'
      service:
        dhcp-relay: {}
        dhcp-relay6: {}
        dhcp-server: {}
        dhcp-server6: {}
        dns: {}
        lldp:
          dot1-tlv: 'off'
          lldp-med-inventory-tlv: 'off'
          mode: default
          tx-hold-multiplier: 4
          tx-interval: 30
        ntp:
          mgmt:
            listen: eth0
            pool: {}
            server:
              0.cumulusnetworks.pool.ntp.org:
                iburst: 'on'
              1.cumulusnetworks.pool.ntp.org:
                iburst: 'on'
              2.cumulusnetworks.pool.ntp.org:
                iburst: 'on'
              3.cumulusnetworks.pool.ntp.org:
                iburst: 'on'
        ptp:
          '1':
            acceptable-master: {}
            domain: 0
            enable: 'off'
            ip-dscp: 46
            logging-level: info
            monitor:
              max-offset-threshold: 50
              max-timestamp-entries: 100
              max-violation-log-entries: 4
              max-violation-log-sets: 2
              min-offset-threshold: -50
              path-delay-threshold: 200
              violation-log-interval: 1
            priority1: 128
            priority2: 128
            profile:
              default-1588:
                announce-interval: 1
                announce-timeout: 3
                delay-mechanism: end-to-end
                delay-req-interval: 0
                domain: 0
                priority1: 128
                priority2: 128
                profile-type: ieee-1588
                sync-interval: 0
                transport: ipv4
              default-itu-8275-1:
                announce-interval: -3
                announce-timeout: 3
                delay-mechanism: end-to-end
                delay-req-interval: -4
                domain: 24
                local-priority: 128
                priority1: 128
                priority2: 128
                profile-type: itu-g-8275-1
                sync-interval: -4
                transport: '802.3'
              default-itu-8275-2:
                announce-interval: 0
                announce-timeout: 3
                delay-mechanism: end-to-end
                delay-req-interval: -6
                domain: 44
                local-priority: 128
                priority1: 128
                priority2: 128
                profile-type: itu-g-8275-2
                sync-interval: -6
                transport: ipv4
            unicast-master: {}
        snmp-server:
          enable: 'off'
        synce:
          enable: 'off'
        syslog: {}
      system:
        aaa:
          authentication-order: {}
          tacacs:
            enable: 'off'
          user: {}
        acl:
          mode: atomic
        config:
          apply:
            ignore: {}
            overwrite: all
          auto-save:
            enable: 'off'
          snippet: {}
        control-plane:
          acl: {}
          policer: {}
          trap: {}
        counter:
          polling-interval:
            logical-interface: 5
            physical-interface: 2
        forwarding:
          ecmp-hash:
            destination-ip: 'on'
            destination-port: 'on'
            gtp-teid: 'off'
            ingress-interface: 'off'
            inner-destination-ip: 'off'
            inner-destination-port: 'off'
            inner-ip-protocol: 'off'
            inner-ipv6-label: 'off'
            inner-source-ip: 'off'
            inner-source-port: 'off'
            ip-protocol: 'on'
            ipv6-label: 'on'
            source-ip: 'on'
            source-port: 'on'
          host-route-preference: route
          lag-hash:
            destination-ip: 'on'
            destination-mac: 'on'
            destination-port: 'on'
            ether-type: 'on'
            gtp-teid: 'off'
            ip-protocol: 'on'
            source-ip: 'on'
            source-mac: 'on'
            source-port: 'on'
            vlan: 'on'
          programming:
            log-level: info
        global:
          anycast-id: none
          anycast-mac: none
          fabric-id: 1
          fabric-mac: none
          l3svd:
            enable: 'off'
          reserved:
            routing-table:
              pbr:
                begin: 10000
                end: 4294966272
            vlan:
              internal:
                range: 3725-3999
              l3-vni-vlan:
                begin: 4000
                end: 4064
          system-mac: auto
        hostname: leaf01
        port-mirror:
          session: {}
        reboot:
          mode: cold
        wjh:
          channel:
            forwarding:
              trigger:
                l2: {}
                l3: {}
                tunnel: {}
          enable: 'on'
      vrf:
        default:
          evpn:
            enable: 'off'
          loopback:
            ip:
              address:
                127.0.0.1/8: {}
                ::1/128: {}
          ptp:
            enable: 'on'
          router:
            bgp:
              enable: 'off'
            nexthop-tracking: {}
            ospf:
              enable: 'off'
            ospf6:
              enable: 'off'
            pim:
              enable: 'off'
            rib: {}
            static: {}
          table: auto
        mgmt:
          evpn:
            enable: 'off'
          loopback:
            ip:
              address:
                127.0.0.1/8: {}
                ::1/128: {}
          ptp:
            enable: 'on'
          router:
            bgp:
              enable: 'off'
            nexthop-tracking: {}
            ospf:
              enable: 'off'
            ospf6:
              enable: 'off'
            rib: {}
            static: {}
          table: auto

TASK [Get the current interface config] ***********************************************************
ok: [leaf01]

TASK [Print current interface] ********************************************************************
ok: [leaf01] =>
  msg:
    changed: false
    failed: false
    message:
      eth0:
        acl: {}
        ip:
          address:
            10.6.10.21/24: {}
          gateway:
            10.6.10.1: {}
          ipv4:
            forward: 'off'
          ipv6:
            enable: 'on'
            forward: 'off'
          vrf: mgmt
        link:
          auto-negotiate: 'on'
          duplex: full
          fec: auto
          mtu: 9216
          speed: auto
          state:
            up: {}
        type: eth
      lo:
        ip:
          address: {}
          igmp:
            enable: 'off'
          ipv4:
            forward: 'on'
          ipv6:
            enable: 'on'
            forward: 'on'
          vrf: default
        router:
          adaptive-routing:
            enable: 'off'
          ospf:
            enable: 'off'
          ospf6:
            enable: 'off'
          pim:
            enable: 'off'
        type: loopback

PLAY RECAP ****************************************************************************************
leaf01                     : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

file interface.yml menggunakan module object-level interface untuk meng-setup interfaces di leaf01

(venv1) ubuntu@ubuntu2:~/nvue$ ansible-playbook playbooks/interface.yml -i hosts
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

PLAY [Test playbook to update interface settings] *************************************************

TASK [Create new revision] ************************************************************************
ok: [leaf01]

TASK [dump revision] ******************************************************************************
ok: [leaf01] =>
  msg: '46'

TASK [Set interface] ******************************************************************************
changed: [leaf01]

TASK [dump previous output] ***********************************************************************
ok: [leaf01] =>
  msg:
    changed: true
    failed: false
    message:
      eth0:
        ip:
          address:
            10.6.10.21/24: {}
            192.168.200.2/24: {}
          gateway:
            10.6.10.1: {}
          vrf: default
        type: eth
      lo:
        ip:
          address:
            10.10.10.1/32: {}
          vrf: default
        type: loopback
      swp51:
        link:
          state:
            up: {}
        type: swp
      swp52:
        link:
          state:
            up: {}
        type: swp
      swp53:
        link:
          state:
            up: {}
        type: swp
      swp54:
        link:
          state:
            up: {}
        type: swp

TASK [Apply new revision] *************************************************************************
ok: [leaf01]

TASK [dump previous output] ***********************************************************************
ok: [leaf01] =>
  msg:
    changed: false
    failed: false
    revid:
      message: Config update by cumulus
      state: applied
      transition:
        issue: {}
        progress: ''

TASK [Fetch interface config] *********************************************************************
ok: [leaf01]

TASK [Display interface config] *******************************************************************
ok: [leaf01] =>
  msg:
    changed: false
    failed: false
    message:
      eth0:
        acl: {}
        ip:
          address:
            10.6.10.21/24: {}
            192.168.200.2/24: {}
          gateway:
            10.6.10.1: {}
          ipv4:
            forward: 'off'
          ipv6:
            enable: 'on'
            forward: 'off'
          vrf: default
        link:
          auto-negotiate: 'on'
          duplex: full
          fec: auto
          mtu: 9216
          speed: auto
          state:
            up: {}
        type: eth
      lo:
        ip:
          address:
            10.10.10.1/32: {}
          igmp:
            enable: 'off'
          ipv4:
            forward: 'on'
          ipv6:
            enable: 'on'
            forward: 'on'
          vrf: default
        router:
          adaptive-routing:
            enable: 'off'
          ospf:
            enable: 'off'
          ospf6:
            enable: 'off'
          pim:
            enable: 'off'
        type: loopback
      swp51:
        acl: {}
        evpn:
          multihoming:
            uplink: 'off'
        ip:
          address: {}
          gateway: {}
          igmp:
            enable: 'off'
          ipv4:
            forward: 'on'
          ipv6:
            enable: 'on'
            forward: 'on'
          neighbor-discovery:
            dnssl: {}
            enable: 'on'
            home-agent:
              enable: 'off'
            prefix: {}
            rdnss: {}
            router-advertisement:
              enable: 'off'
          vrf: default
          vrrp:
            enable: 'off'
        link:
          auto-negotiate: 'on'
          breakout: {}
          duplex: full
          fec: auto
          mtu: 9216
          speed: auto
          state:
            up: {}
        ptp:
          enable: 'off'
        router:
          adaptive-routing:
            enable: 'off'
          ospf:
            enable: 'off'
          ospf6:
            enable: 'off'
          pbr:
            map: {}
          pim:
            enable: 'off'
        synce:
          enable: 'off'
        type: swp
      swp52:
        acl: {}
        evpn:
          multihoming:
            uplink: 'off'
        ip:
          address: {}
          gateway: {}
          igmp:
            enable: 'off'
          ipv4:
            forward: 'on'
          ipv6:
            enable: 'on'
            forward: 'on'
          neighbor-discovery:
            dnssl: {}
            enable: 'on'
            home-agent:
              enable: 'off'
            prefix: {}
            rdnss: {}
            router-advertisement:
              enable: 'off'
          vrf: default
          vrrp:
            enable: 'off'
        link:
          auto-negotiate: 'on'
          breakout: {}
          duplex: full
          fec: auto
          mtu: 9216
          speed: auto
          state:
            up: {}
        ptp:
          enable: 'off'
        router:
          adaptive-routing:
            enable: 'off'
          ospf:
            enable: 'off'
          ospf6:
            enable: 'off'
          pbr:
            map: {}
          pim:
            enable: 'off'
        synce:
          enable: 'off'
        type: swp
      swp53:
        acl: {}
        evpn:
          multihoming:
            uplink: 'off'
        ip:
          address: {}
          gateway: {}
          igmp:
            enable: 'off'
          ipv4:
            forward: 'on'
          ipv6:
            enable: 'on'
            forward: 'on'
          neighbor-discovery:
            dnssl: {}
            enable: 'on'
            home-agent:
              enable: 'off'
            prefix: {}
            rdnss: {}
            router-advertisement:
              enable: 'off'
          vrf: default
          vrrp:
            enable: 'off'
        link:
          auto-negotiate: 'on'
          breakout: {}
          duplex: full
          fec: auto
          mtu: 9216
          speed: auto
          state:
            up: {}
        ptp:
          enable: 'off'
        router:
          adaptive-routing:
            enable: 'off'
          ospf:
            enable: 'off'
          ospf6:
            enable: 'off'
          pbr:
            map: {}
          pim:
            enable: 'off'
        synce:
          enable: 'off'
        type: swp
      swp54:
        acl: {}
        evpn:
          multihoming:
            uplink: 'off'
        ip:
          address: {}
          gateway: {}
          igmp:
            enable: 'off'
          ipv4:
            forward: 'on'
          ipv6:
            enable: 'on'
            forward: 'on'
          neighbor-discovery:
            dnssl: {}
            enable: 'on'
            home-agent:
              enable: 'off'
            prefix: {}
            rdnss: {}
            router-advertisement:
              enable: 'off'
          vrf: default
          vrrp:
            enable: 'off'
        link:
          auto-negotiate: 'on'
          breakout: {}
          duplex: full
          fec: auto
          mtu: 9216
          speed: auto
          state:
            up: {}
        ptp:
          enable: 'off'
        router:
          adaptive-routing:
            enable: 'off'
          ospf:
            enable: 'off'
          ospf6:
            enable: 'off'
          pbr:
            map: {}
          pim:
            enable: 'off'
        synce:
          enable: 'off'
        type: swp

PLAY RECAP ****************************************************************************************
leaf01                     : ok=8    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

File bridge.yml menggunakan module object-level bridge untuk meng-setup bridge domain br_default di dalam leaf01

(venv1) ubuntu@ubuntu2:~/nvue$ ansible-playbook playbooks/bridge.yml -i hosts
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

PLAY [Test playbook to update bridge settings] ****************************************************

TASK [Create new revision] ************************************************************************
ok: [leaf01]

TASK [dump revision] ******************************************************************************
ok: [leaf01] =>
  msg: '47'

TASK [Set bridge] *********************************************************************************
changed: [leaf01]

TASK [dump previous output] ***********************************************************************
ok: [leaf01] =>
  msg:
    changed: true
    failed: false
    message:
      br_default:
        encap: 802.1Q
        mac-address: auto
        type: vlan-aware
        vlan:
          '10':
            vni:
              '10': {}
          '20':
            vni:
              '20': {}
          '30':
            vni:
              '30': {}

TASK [Apply new revision] *************************************************************************
ok: [leaf01]

TASK [dump previous output] ***********************************************************************
ok: [leaf01] =>
  msg:
    changed: false
    failed: false
    revid:
      message: Config update by cumulus
      state: applied
      transition:
        issue: {}
        progress: ''

TASK [Fetch bridge config] ************************************************************************
ok: [leaf01]

TASK [Display bridge config] **********************************************************************
ok: [leaf01] =>
  msg:
    changed: false
    failed: false
    message:
      br_default:
        ageing: 1800
        encap: 802.1Q
        mac-address: auto
        multicast:
          snooping:
            enable: 'on'
            querier:
              enable: 'off'
        stp:
          priority: 32768
          state:
            up: {}
        type: vlan-aware
        untagged: 1
        vlan:
          '10':
            multicast:
              snooping:
                querier:
                  source-ip: 0.0.0.0
            ptp:
              enable: 'off'
            vni:
              '10':
                flooding:
                  enable: auto
                mac-learning: auto
          '20':
            multicast:
              snooping:
                querier:
                  source-ip: 0.0.0.0
            ptp:
              enable: 'off'
            vni:
              '20':
                flooding:
                  enable: auto
                mac-learning: auto
          '30':
            multicast:
              snooping:
                querier:
                  source-ip: 0.0.0.0
            ptp:
              enable: 'off'
            vni:
              '30':
                flooding:
                  enable: auto
                mac-learning: auto
        vlan-vni-offset: 0

PLAY RECAP ****************************************************************************************
leaf01                     : ok=8    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

file clean-switches.yml untuk menghapus konfigurasi pada switch menjadi ke konfig awal.

(venv1) ubuntu@ubuntu2:~/nvue$ ansible-playbook playbooks/clean-switches.yml -i hosts
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

PLAY [Test cleanup script] **

TASK [Gathering Facts]
ok: [spine01]
ok: [leaf01]
ok: [leaf02]

TASK [Set config to startup]
ok: [leaf01]
ok: [spine01]
ok: [leaf02]

TASK [Show current config] **
ok: [leaf02]
ok: [spine01]
ok: [leaf01]

TASK [Print current config] *
ok: [leaf01] =>
msg: |-
- header:
model: VX
nvue-api-version: nvue_v1
rev-id: 1.0
version: Cumulus Linux 5.5.1
- set:
interface:
eth0:
ip:
address:
10.6.10.21/24: {}
gateway:
10.6.10.1: {}
type: eth
service:
ntp:
mgmt:
server:
0.cumulusnetworks.pool.ntp.org: {}
1.cumulusnetworks.pool.ntp.org: {}
2.cumulusnetworks.pool.ntp.org: {}
3.cumulusnetworks.pool.ntp.org: {}
system:
hostname: leaf01
wjh:
channel:
forwarding:
trigger:
l2: {}
l3: {}
tunnel: {}
enable: on
ok: [leaf02] =>
msg: |-
- header:
model: VX
nvue-api-version: nvue_v1
rev-id: 1.0
version: Cumulus Linux 5.5.1
- set:
interface:
eth0:
ip:
address:
10.6.10.22/24: {}
gateway:
10.6.10.1: {}
type: eth
service:
ntp:
mgmt:
server:
0.cumulusnetworks.pool.ntp.org: {}
1.cumulusnetworks.pool.ntp.org: {}
2.cumulusnetworks.pool.ntp.org: {}
3.cumulusnetworks.pool.ntp.org: {}
system:
hostname: leaf02
wjh:
channel:
forwarding:
trigger:
l2: {}
l3: {}
tunnel: {}
enable: on
ok: [spine01] =>
msg: |-
- header:
model: VX
nvue-api-version: nvue_v1
rev-id: 1.0
version: Cumulus Linux 5.5.1
- set:
interface:
eth0:
ip:
address:
10.6.10.20/24: {}
gateway:
10.6.10.1: {}
type: eth
service:
ntp:
mgmt:
server:
0.cumulusnetworks.pool.ntp.org: {}
1.cumulusnetworks.pool.ntp.org: {}
2.cumulusnetworks.pool.ntp.org: {}
3.cumulusnetworks.pool.ntp.org: {}
system:
hostname: spine01
wjh:
channel:
forwarding:
trigger:
l2: {}
l3: {}
tunnel: {}
enable: on

PLAY RECAP ****
leaf01 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
leaf02 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
spine01 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

Leave a Reply

Your email address will not be published. Required fields are marked *