Configure interfaces with Ansible

 Today we will be configuring network devices from Ansible using ios_config module.


Ansible playbook to create loopback interfaces and add description
---
 - name: Define Parameters
  hosts: XE
  gather_facts: no
  connection: network_cli
  tasks:
    - name: Create loopback interfaces
      ios_config:
        lines:
          - description loopback interface by prashant
        parents: "{{ item }}"
      with_items:
          - interface loopback 25
          - interface loopback 30
          - interface loopback 35




[prashant@Prashant-VM01 ~]$ ansible-playbook play05.yml -i /home/prashant/inventory -u developer -k
SSH password:
 PLAY [Define Parameters] ****************************************************************************************************************
 TASK [Create loopback interfaces] *******************************************************************************************************
changed: [ios-xe-mgmt-latest.cisco.com] => (item=interface loopback 25)
changed: [ios-xe-mgmt-latest.cisco.com] => (item=interface loopback 30)
changed: [ios-xe-mgmt-latest.cisco.com] => (item=interface loopback 35)
changed: [ios-xe-mgmt.cisco.com] => (item=interface loopback 25)
changed: [ios-xe-mgmt.cisco.com] => (item=interface loopback 30)
changed: [ios-xe-mgmt.cisco.com] => (item=interface loopback 35)
 PLAY RECAP ******************************************************************************************************************************
ios-xe-mgmt-latest.cisco.com : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
ios-xe-mgmt.cisco.com      : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0


Comments

Popular posts from this blog

Anyconnect SSL-Client VPN with Self-signed Certificate on Cisco ASA

Filtering Routes in BGP using Route-maps and Prefix-list

Open Shortest Path First (OSPF)

IKEv2 IPsec Site-to-Site VPN configuration on Cisco ASA 8.4(x)

IPsec VPN as a Backup for Point-to-Point Link using IP SLA

Border Gateway Protocol (BGP)

Cisco ASA Active/Active Failover Configuration

Bypassing Proxy Server in Google Chrome

Cisco ASA Active/Standby Failover Configuration