Apply a single iRule to several VS with a single action

Hi,

I’m trying to apply an iRule to several Virtual Servers using a single action. I guess that can be done with a script using the CLI. Do you have any ideas, examples?

Thanks

This is what i do:

1) Log into the BigIP via ssh

2) Create a file which contains

virtual vs1 {
   rule newrule
}
virtual vs2 {
   rule newrule
}
virtual vs3 {
   rule newrule
}
...

3) Make sure you have a backup of the config by executing

bigpipe save

4) Execute the command

bigpipe merge

This will change the rule line of the virtuals you specify. Note that if you have other rules applied to the virtual, this will overwrite the config so you would have to use

virtual vs {
   rule oldrule newrule
}

if you want to retain the old rule.

-Al

Thanks Al, it works!!!

Just one more question. What about if I want to remove the irule?

Thanks

iControl is probably your best bet there. It’s a very simple method to add/remove rules from Virtuals.

-Joe

If you want to delete a single rule, it is easy to do on the GUI. However, you can’t delete a rule if it is applied to a virtual. You’ll have to delete it from all the virtual servers to which it has been apllied first.

If you want to delete the rule from a number of virtual servers then delete the rule, then you can create a file like:

b virtual vs1 {
   rule none
}
b virtual vs2 {
   rule none
}
...
b rule thisrule delete

Then merge it with a ‘b merge filename’.

This will delete all the rules applied to the specified virtuals. If there are other rules you don’t want to delete just list them on the rule line instead of the keyword ‘none’

-Al