Forum Discussion

sundogbrew's avatar
sundogbrew
Icon for Altocumulus rankAltocumulus
Apr 15, 2018

Cert replacement script

Hey Guys, I have a script I have used a bunch of times to replace the cert on a bunch of apps (we use a *) However, I am testing it and it doesn't work anymore? I have been looking at this for hours and can't see it?

 

tmsh list ltm virtual one-line|grep old-cert|cut -d' ' -f3| xargs -I_-n1 tmsh modify ltm virtual _ profiles delete { old-cert } profiles add { new-cert }

The error I am getting is this The requested virtual server profile (/Common/_ /Common/old-cert) was not found.

 

As always, help is greatly appreciated! Thanks Joe

 

1 Reply

  • Hello,

    I think you missed one space in the xargs expression between -I_ and n1 "xargs -I_ -n1", in your script is writing "xargs-I_-n1", so "_" is not being replaced by your virtual server name and you send to tmsh "tmsh modify ltm virtual _" and virtual _ does not exit.

     tmsh list ltm virtual one-line|grep old-cert|cut -d' ' -f3| xargs -I_ -n1 tmsh modify ltm virtual _ profiles delete { old-cert } profiles add { new-cert }
    

    If this does not solve the problem, I recomend you check procedure step by step:

    Check virtual with the profils "old-cert":

    tmsh list ltm virtual one-line|grep old-cert 
    

    Capture virtual names:

    tmsh list ltm virtual one-line|grep old-cert|cut -d' ' -f3
    

    ....