Tuesday, 26 March 2019

anisible playbook to manage paloalto interface



---
 - name: PALOALTOInterfaceManagement
   gather_facts: no
   connection: local
   hosts: PALOALTO
 
   vars:
     action: setIPAddress
     vdomname: root
     interfacename: ['interface port-channel 35.3102']
     ip: 192.168.101.101
     mask: 255.255.255.0
     speedmode: auto
     duplexmode: auto
     securityinterfacename: inside
     securitylevelnumber: 0
     devicetype: fortigate
     vlanNumber: 10
     vrName: test
   cli:
      host:
      username: admin
      password: admin@123
      timeout: 30

    - name: setIPAddress 
      when: action == "setIPAddress" and devicetype == "paloalto"
      panos_interface:
         commands:
            - "set network interface {{interfacename}} layer3 ip {{ip}}"


    - name: unsetIPAddress
      when: action == "unsetIPAddress" and devicetype == "paloalto"
      panos_interface:
         commands:
            - "unset network interface {{interfacename}} layer3 ip {{ip}}"

   - name: createSubinterface
      when: action == "createSubinterface" and devicetype == "paloalto"
      pnos_interface:
         commands:
            - "set network interface {{interfacename}} layer3 units 1 tag {{vlanNumber}}"
            - "set network interface {{interfacename}} layer3 units 1 tag {{ip}}"

   - name: addingInterfaceToARouter
      when: action == "addingInterfaceToARouter" and devicetype == "paloalto"
      pnos_interface:
         commands:
            - "set network virtual-router {{vrName}} interface{{interfacename}} layer3 units 1 tag {{ip}}"

No comments:

Post a Comment

Git

1 git add ↳ It lets you add changes from the working directory into the staging area 2 git commit ↳ It lets you save a snapshot of currently...