Forum Discussion

bsg273_163868's avatar
bsg273_163868
Icon for Nimbostratus rankNimbostratus
Oct 27, 2015

Changing Virtual Server's Access Profile with TMSH w/o Knowing Its Current Value

I am trying to use tmsh to change the Access Profile that is assigned to a given virtual server without knowing its current value. In the f5 Console GUI this is straightforward. When you navigate to Local traffic -> Virtual Servers -> Virtual Server List and click on a given virtual server, you can then scroll down and change the Access Profile assigned to that virtual server in the dropdown next to "Access Profile", click update, and you're done ... no need to know what the access profile was set to beforehang, you can just change the dropdown next to the "Access Profile" label. However, when I'm performing the same action using a tmsh command, I seem to have to know the value that assigned Access Profile is currently set to in order to be able to delete the profile out of that virtual server's properties and add in my new one. Here is the tmsh command I'm using ...

modify ltm virtual MY_VIRTUAL_SERVER profiles add {ACCESS_PROFILE_NEW} profiles delete {ACCESS_PROFILE_ORIG}

My point is that I need to know that the access profile is set to

ACCESS_PROFILE_ORIG
before issuing this command to reassign the access profile value. Is there any way to just have tmsh somehow detect what the access profile is set to and then delete it?

20 Replies

  • You should be able to just use

    modify ltm virtual MY_VIRTUAL_SERVER profiles replace-all-with {ACCESS_PROFILE_NEW}

    • Brad_Parker_139's avatar
      Brad_Parker_139
      Icon for Nacreous rankNacreous
      Probably best to list ltm virtual one-line first so you know all the other profile you have attached as well if you replace-all-with.
    • bsg273_163868's avatar
      bsg273_163868
      Icon for Nimbostratus rankNimbostratus
      Ok so how would I preserve all those other profiles and just replace the Access Profile specifically?
    • Brad_Parker_139's avatar
      Brad_Parker_139
      Icon for Nacreous rankNacreous
      Well, you would have to put them all into the curlies with the new profile. Its actually probably much easier to "list ltm virtual VS_name profiles" to gather the list of profiles and just use your original add/delete tmsh since you are querying what the original profile was anyway.
  • You should be able to just use

    modify ltm virtual MY_VIRTUAL_SERVER profiles replace-all-with {ACCESS_PROFILE_NEW}

    • Brad_Parker's avatar
      Brad_Parker
      Icon for Cirrus rankCirrus
      Probably best to list ltm virtual one-line first so you know all the other profile you have attached as well if you replace-all-with.
    • bsg273_163868's avatar
      bsg273_163868
      Icon for Nimbostratus rankNimbostratus
      Ok so how would I preserve all those other profiles and just replace the Access Profile specifically?
    • Brad_Parker's avatar
      Brad_Parker
      Icon for Cirrus rankCirrus
      Well, you would have to put them all into the curlies with the new profile. Its actually probably much easier to "list ltm virtual VS_name profiles" to gather the list of profiles and just use your original add/delete tmsh since you are querying what the original profile was anyway.