Forum Discussion

Mitesh_378646's avatar
Mitesh_378646
Icon for Nimbostratus rankNimbostratus
Dec 12, 2018

How to Modify iRule and apply new iRule through API.

Hi Experts, I am completely new to F5 and its a completely grey area for me.I came across a situation where i need to apply one of the two iRule to virtual application defined in LTM. How can do this from PowerShell ? Is there any API if so how to call that ? How to call this from TFS release task ?

 

To give you the context, I am in process of automating the release process for one of the application in TFS ( which means i need to call the API from TFS release task ).

 

8 Replies

  • Thanks so much for the info. Do you know how to use it ? Do I just need to use that single powellshell script "Set-iRule.ps1" or something else. ?

     

    • JRahm's avatar
      JRahm
      Icon for Admin rankAdmin

      The usage information for the module is in the readme on Github. You need to establish your credentials, and then instantiate the BIG-IP.

      $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
      $mycreds = New-Object System.Management.Automation.PSCredential "username", $secpasswd
      New-F5Session -LTMName "192.168.1.245" -LTMCredentials $mycreds
      

      This of course assumes you are using basic auth instead of tokens.

    • Mitesh_378646's avatar
      Mitesh_378646
      Icon for Nimbostratus rankNimbostratus

      Thanks Tiziano & Jason for your help. Does that mean to set\update the iRule i just need to include 'Set-iRule.Ps1' or 'Get-iRule' in my TFS release task and execute it ?

       

      Thanks Again for your help and pointing me to right direction.

       

    • JRahm's avatar
      JRahm
      Icon for Admin rankAdmin

      Yes, after instantiation you should be able to just run the script. Note the credentials line in the Set-iRule.ps1 srcipt.

       

      However, please note I'm not sure exactly about the mechanics of TFS as I'm unfamiliar with the platform.